diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-28 23:29:38 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-28 23:29:38 +0000 |
commit | 25aebae77d29f2984078606f0789a6db36218ea9 (patch) | |
tree | 8e06d8c7722cb5e6de9e460d773c91f8495cfb52 | |
parent | 023c88aaa0c53038459a8f493ca98de558d31cb7 (diff) | |
download | coreutils-25aebae77d29f2984078606f0789a6db36218ea9.tar.xz |
* src/copy.c (copy_internal): Don't test whether macros like
S_ISLNK are defined, since they're always defined now.
* src/cp.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (get_link_name, make_link_name): Likewise.
* src/mkfifo.c (usage): Likewise.
* src/who.c (S_IWGRP): Likewise.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/copy.c | 22 | ||||
-rw-r--r-- | src/cp.c | 5 | ||||
-rw-r--r-- | src/ln.c | 5 | ||||
-rw-r--r-- | src/ls.c | 4 | ||||
-rw-r--r-- | src/mkfifo.c | 6 | ||||
-rw-r--r-- | src/who.c | 6 |
7 files changed, 15 insertions, 41 deletions
@@ -1,5 +1,13 @@ 2006-08-28 Paul Eggert <eggert@cs.ucla.edu> + * src/copy.c (copy_internal): Don't test whether macros like + S_ISLNK are defined, since they're always defined now. + * src/cp.c (main): Likewise. + * src/ln.c (main): Likewise. + * src/ls.c (get_link_name, make_link_name): Likewise. + * src/mkfifo.c (usage): Likewise. + * src/who.c (S_IWGRP): Likewise. + Adjust to recent gnulib changes for the gnulib module. * bootstrap.conf (gnulib_modules): Add fcntl. * src/system.h (SEEK_SET, SEEK_CUR, SEEK_END): Remove. Other code diff --git a/src/copy.c b/src/copy.c index c8d09b4ee..e1406f7c2 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1558,7 +1558,6 @@ copy_internal (char const *src_name, char const *dst_name, delayed_ok = false; } } -#ifdef S_ISLNK else if (x->symbolic_link) { preserve_metadata = false; @@ -1597,7 +1596,6 @@ copy_internal (char const *src_name, char const *dst_name, goto un_backup; } } -#endif else if (x->hard_link #ifdef LINK_FOLLOWS_SYMLINKS @@ -1632,9 +1630,7 @@ copy_internal (char const *src_name, char const *dst_name, if (! copy_reg (src_name, dst_name, x, src_mode, &new_dst, &src_sb)) goto un_backup; } - else -#ifdef S_ISFIFO - if (S_ISFIFO (src_type)) + else if (S_ISFIFO (src_type)) { if (mkfifo (dst_name, src_mode)) { @@ -1642,10 +1638,7 @@ copy_internal (char const *src_name, char const *dst_name, goto un_backup; } } - else -#endif - if (S_ISBLK (src_type) || S_ISCHR (src_type) - || S_ISSOCK (src_type)) + else if (S_ISBLK (src_type) || S_ISCHR (src_type) || S_ISSOCK (src_type)) { if (mknod (dst_name, src_mode, src_sb.st_rdev)) { @@ -1654,9 +1647,7 @@ copy_internal (char const *src_name, char const *dst_name, goto un_backup; } } - else -#ifdef S_ISLNK - if (S_ISLNK (src_type)) + else if (S_ISLNK (src_type)) { char *src_link_val = xreadlink (src_name, src_sb.st_size); if (src_link_val == NULL) @@ -1700,7 +1691,7 @@ copy_internal (char const *src_name, char const *dst_name, { /* Preserve the owner and group of the just-`copied' symbolic link, if possible. */ -# if HAVE_LCHOWN +#if HAVE_LCHOWN if (lchown (dst_name, src_sb.st_uid, src_sb.st_gid) != 0 && ! chown_failure_ok (x)) { @@ -1708,16 +1699,15 @@ copy_internal (char const *src_name, char const *dst_name, dst_name); goto un_backup; } -# else +#else /* Can't preserve ownership of symlinks. FIXME: maybe give a warning or even error for symlinks in directories with the sticky bit set -- there, not preserving owner/group is a potential security problem. */ -# endif +#endif } } else -#endif { error (0, 0, _("%s has unknown file type"), quote (src_name)); goto un_backup; @@ -957,12 +957,7 @@ main (int argc, char **argv) break; case 's': -#ifdef S_ISLNK x.symbolic_link = true; -#else - error (EXIT_FAILURE, 0, - _("symbolic links are not supported on this system")); -#endif break; case 't': @@ -428,12 +428,7 @@ main (int argc, char **argv) dereference_dest_dir_symlinks = false; break; case 's': -#ifdef S_ISLNK symbolic_link = true; -#else - error (EXIT_FAILURE, 0, - _("symbolic links are not supported on this system")); -#endif break; case 't': if (target_directory) @@ -2760,9 +2760,6 @@ is_directory (const struct fileinfo *f) return f->filetype == directory || f->filetype == arg_directory; } - -#ifdef S_ISLNK - /* Put the name of the file that FILENAME is a symbolic link to into the LINKNAME field of `f'. COMMAND_LINE_ARG indicates whether FILENAME is a command-line argument. */ @@ -2805,7 +2802,6 @@ make_link_name (char const *name, char const *linkname) strcpy (linkbuf + bufsiz, linkname); return linkbuf; } -#endif /* Return true if the last component of NAME is `.' or `..' This is so we don't try to recurse on `././././. ...' */ diff --git a/src/mkfifo.c b/src/mkfifo.c index a16d93cb7..d329b79b8 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -43,7 +43,6 @@ static struct option const longopts[] = {NULL, 0, NULL, 0} }; -#ifdef S_ISFIFO void usage (int status) { @@ -69,7 +68,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\ } exit (status); } -#endif int main (int argc, char **argv) @@ -87,9 +85,6 @@ main (int argc, char **argv) atexit (close_stdout); -#ifndef S_ISFIFO - error (EXIT_FAILURE, 0, _("fifo files not supported")); -#else while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1) { switch (optc) @@ -131,5 +126,4 @@ main (int argc, char **argv) } exit (exit_status); -#endif } @@ -1,5 +1,5 @@ /* GNU's who. - Copyright (C) 1992-2005 Free Software Foundation, Inc. + Copyright (C) 1992-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,10 +48,6 @@ # define MAXHOSTNAMELEN 64 #endif -#ifndef S_IWGRP -# define S_IWGRP 020 -#endif - #ifdef RUN_LVL # define UT_TYPE_RUN_LVL(U) UT_TYPE_EQ (U, RUN_LVL) #else |