diff options
author | Jim Meyering <jim@meyering.net> | 2001-09-15 12:46:05 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-09-15 12:46:05 +0000 |
commit | e1e70abfabc69205aa2572a07316256fab4ce072 (patch) | |
tree | 96b6c3fddcf975921fed09706afb00e7a9ed1e6e | |
parent | cb40817c279db84c61ae1df5330670839e036a16 (diff) | |
download | coreutils-e1e70abfabc69205aa2572a07316256fab4ce072.tar.xz |
(UNWRITABLE): Define (factored out of copy_internal).
(copy_internal): Use UNWRITABLE.
-rw-r--r-- | src/copy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/copy.c b/src/copy.c index ae9d6ad1d..c3135ab87 100644 --- a/src/copy.c +++ b/src/copy.c @@ -49,6 +49,11 @@ #define SAME_GROUP(A, B) ((A).st_gid == (B).st_gid) #define SAME_OWNER_AND_GROUP(A, B) (SAME_OWNER (A, B) && SAME_GROUP (A, B)) +#define UNWRITABLE(File_name, File_mode) \ + ( /* euidaccess is not meaningful for symlinks */ \ + ! S_ISLNK (File_mode) \ + && euidaccess (File_name, W_OK) != 0) + struct dir_list { struct dir_list *parent; @@ -696,18 +701,15 @@ copy_internal (const char *src_path, const char *dst_path, if (x->interactive == I_ALWAYS_NO) { - if (! S_ISLNK (dst_sb.st_mode) - && euidaccess (dst_path, W_OK) != 0) + if (UNWRITABLE (dst_path, dst_sb.st_mode)) { do_move = 0; } } else if (x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED - && (x->stdin_tty - /* euidaccess is not meaningful for symlinks */ - && ! S_ISLNK (dst_sb.st_mode) - && euidaccess (dst_path, W_OK) != 0))) + && x->stdin_tty + && UNWRITABLE (dst_path, dst_sb.st_mode))) { overwrite_prompt (dst_path, &dst_sb); if (!yesno ()) |