diff options
author | Jim Meyering <jim@meyering.net> | 1993-05-22 02:01:31 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-05-22 02:01:31 +0000 |
commit | 9528d5ae7331ef0cf6cf75b7a6f49e5f6826660c (patch) | |
tree | d22e7eb2076d565e8be0b5efa97ec2d7b8a8fded | |
parent | a73c9d84fca6144d8aad9e4104a4a18f87dcb23e (diff) | |
download | gnulib-9528d5ae7331ef0cf6cf75b7a6f49e5f6826660c.tar.gz |
GNU file utilitiesFILEUTILS-3_5_5
-rw-r--r-- | lib/fsusage.c | 2 | ||||
-rw-r--r-- | lib/mountlist.c | 26 | ||||
-rw-r--r-- | lib/rename.c | 22 |
3 files changed, 47 insertions, 3 deletions
diff --git a/lib/fsusage.c b/lib/fsusage.c index 2a1fe86c75..c9ed26c878 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -156,9 +156,11 @@ get_fs_usage (path, disk, fsp) no matter what value f_bsize has. */ #define convert_blocks(b) (b) #ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx. */ +#ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */ #define f_bavail f_bfree #endif #endif +#endif #ifdef STAT_STATVFS /* SVR4. */ struct statvfs fsd; diff --git a/lib/mountlist.c b/lib/mountlist.c index 947fb7ed27..4528c9e0dc 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -82,6 +82,12 @@ void error (); #include <sys/vfs.h> #endif +#ifdef DOLPHIN +/* So special that it's not worth putting this in autoconf. */ +#undef MOUNTED_FREAD_FSTYP +#define MOUNTED_GETMNTTBL +#endif + #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ /* Return the value of the hexadecimal number represented by CP. No prefix (like '0x') or suffix (like 'h') is expected to be @@ -358,6 +364,26 @@ read_filesystem_list (need_fs_type, all_fs) } #endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */ +#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes it's own way */ + { + struct mntent **mnttbl=getmnttbl(),**ent; + for (ent=mnttbl;*ent;ent++) + { + me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry)); + me->me_devname = xstrdup ( (*ent)->mt_resource); + me->me_mountdir = xstrdup( (*ent)->mt_directory); + me->me_type = xstrdup ((*ent)->mt_fstype); + me->me_dev = -1; /* Magic; means not known yet. */ + me->me_next = NULL; + + /* Add to the linked list. */ + mtail->me_next = me; + mtail = me; + } + endmnttbl(); + } +#endif + #ifdef MOUNTED_GETMNTENT2 /* SVR4. */ { struct mnttab mnt; diff --git a/lib/rename.c b/lib/rename.c index a40bbb5ae7..858190c57d 100644 --- a/lib/rename.c +++ b/lib/rename.c @@ -34,14 +34,30 @@ rename (from, to) char *from; char *to; { - struct stat from_stats; + struct stat from_stats, to_stats; int pid, status; if (stat (from, &from_stats)) return -1; - if (unlink (to) && errno != ENOENT) - return -1; + /* Be careful not to unlink `from' if it happens to be equal to `to' or + (on filesystems that silently truncate filenames after 14 characters) + if `from' and `to' share the significant characters. */ + if (stat (to, &to_stats)) + { + if (errno != ENOENT) + return -1; + } + else + { + if ((from_stats.st_dev == to_stats.st_dev) + && (from_stats.st_ino == to_stats.st_dev)) + /* `from' and `to' designate the same file on that filesystem. */ + return 0; + + if (unlink (to) && errno != ENOENT) + return -1; + } if (S_ISDIR (from_stats.st_mode)) { |