diff options
author | Jim Meyering <jim@meyering.net> | 1999-01-25 15:13:10 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-01-25 15:13:10 +0000 |
commit | f525fd81ca4589d2ba1761a0ab1d2da3e84c895d (patch) | |
tree | 16e23321ca2b919d81ca415899355c3ac5b01683 /src | |
parent | 89826ef42016c0ead8a1e4728d40757da70ebd34 (diff) | |
download | coreutils-f525fd81ca4589d2ba1761a0ab1d2da3e84c895d.tar.xz |
(isaac_seed): Guard clock_gettime with test of
HAVE_CLOCK_GETTIME, not CLOCK_REALTIME.
(wipename): Rename local dirfd to dir_fd to avoid shadowing the
function declared in Linux's dirent.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/shred.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/shred.c b/src/shred.c index 16cf4242c..8ca8df388 100644 --- a/src/shred.c +++ b/src/shred.c @@ -372,7 +372,7 @@ isaac_seed (struct isaac_state *s) s->mm[1] = getppid (); { -#ifdef CLOCK_REALTIME /* POSIX ns-resolution */ +#ifdef HAVE_CLOCK_GETTIME /* POSIX ns-resolution */ struct timespec ts; clock_gettime (CLOCK_REALTIME, &ts); s->mm[2] = ts.tv_sec; @@ -1153,7 +1153,7 @@ wipename (char *oldname, struct Options const *flags) char *base; /* Pointer to filename component, after directories. */ unsigned len; int err; - int dirfd; /* Try to open directory to sync *it* */ + int dir_fd; /* Try to open directory to sync *it* */ if (flags->verbose) pfstatus (_("%s: deleting"), oldname); @@ -1181,12 +1181,12 @@ wipename (char *oldname, struct Options const *flags) if (base) { *base = '\0'; - dirfd = open (newname, O_RDONLY); + dir_fd = open (newname, O_RDONLY); *base = '/'; } else { - dirfd = open (".", O_RDONLY); + dir_fd = open (".", O_RDONLY); } base = base ? base + 1 : newname; len = strlen (base); @@ -1200,7 +1200,7 @@ wipename (char *oldname, struct Options const *flags) if (access (newname, F_OK) < 0 && !rename (oldname, newname)) { - if (dirfd < 0 || fdatasync (dirfd) < 0) + if (dir_fd < 0 || fdatasync (dir_fd) < 0) sync (); /* Force directory out */ if (origname) { @@ -1221,9 +1221,9 @@ wipename (char *oldname, struct Options const *flags) } free (newname); err = remove (oldname); - if (dirfd < 0 || fdatasync (dirfd) < 0) + if (dir_fd < 0 || fdatasync (dir_fd) < 0) sync (); - close (dirfd); + close (dir_fd); if (origname) { if (!err && flags->verbose) |