comparison mac/src/mac.c @ 39102:9647ef27680a

2001-09-04 Andrew Choi <akochoi@cse.cuhk.edu.hk> * src/mac.c (stat): Don't fail for aliases. (sys_open) [__MRC__]: Set file creator and type for newly-created files.
author Andrew Choi <akochoi@shaw.ca>
date Tue, 04 Sep 2001 05:00:04 +0000
parents bd309345e7ea
children c56375806351
comparison
equal deleted inserted replaced
39101:6e45d26a2555 39102:9647ef27680a
328 } 328 }
329 329
330 if (cipb.hFileInfo.ioFlFndrInfo.fdFlags & 0x8000) 330 if (cipb.hFileInfo.ioFlFndrInfo.fdFlags & 0x8000)
331 { 331 {
332 /* identify alias files as symlinks */ 332 /* identify alias files as symlinks */
333 buf->st_mode &= ~S_IFREG;
333 buf->st_mode |= S_IFLNK; 334 buf->st_mode |= S_IFLNK;
334 buf->st_mode &= ~S_IFREG;
335 } 335 }
336 336
337 buf->st_nlink = 1; 337 buf->st_nlink = 1;
338 buf->st_uid = getuid (); 338 buf->st_uid = getuid ();
339 buf->st_gid = getgid (); 339 buf->st_gid = getgid ();
365 { 365 {
366 int result; 366 int result;
367 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 367 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
368 int len; 368 int len;
369 369
370 if ((result = stat_noalias (path, sb)) >= 0) 370 if ((result = stat_noalias (path, sb)) >= 0 &&
371 ! (sb->st_mode & S_IFLNK))
371 return result; 372 return result;
372 373
373 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 374 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
374 return -1; 375 return -1;
375 376
603 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 604 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
604 return -1; 605 return -1;
605 else 606 else
606 { 607 {
607 #ifdef __MRC__ 608 #ifdef __MRC__
608 if (oflag == O_WRONLY || oflag == O_RDWR) 609 int res = open (mac_pathname, oflag);
610 /* if (oflag == O_WRONLY || oflag == O_RDWR) */
611 if (oflag & O_CREAT)
609 fsetfileinfo (mac_pathname, 'EMAx', 'TEXT'); 612 fsetfileinfo (mac_pathname, 'EMAx', 'TEXT');
613 return res;
614 #else
615 return open (mac_pathname, oflag);
610 #endif 616 #endif
611 return open (mac_pathname, oflag);
612 } 617 }
613 } 618 }
614 619
615 620
616 #undef creat 621 #undef creat