summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-09-19 22:11:38 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-09-19 22:11:38 +0000
commit7889cfbbc7a0fff35d65dce18bc995816aec2389 (patch)
tree52b1d905b00fd6fb58aef724342b2d696aae15e7
parent90616d3a8f990ede0a4924fb780730826a72c16f (diff)
downloadcoreutils-7889cfbbc7a0fff35d65dce18bc995816aec2389.tar.xz
* src/ln.c (target_directory_operand): Rewrite to avoid porting
problem on Tandem reported by Matthew Woehlke in <https://savannah.gnu.org/bugs/?17172>.
-rw-r--r--ChangeLog6
-rw-r--r--src/ln.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d51b10411..db940937e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ * src/ln.c (target_directory_operand): Rewrite to avoid porting
+ problem on Tandem reported by Matthew Woehlke in
+ <https://savannah.gnu.org/bugs/?17172>.
+
2006-09-18 Paul Eggert <eggert@cs.ucla.edu>
Fix bug where chmod, chown, and chgrp did not process operands
diff --git a/src/ln.c b/src/ln.c
index 46d583465..0aa5ac520 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -112,8 +112,9 @@ target_directory_operand (char const *file)
size_t blen = strlen (b);
bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
struct stat st;
- int err = ((dereference_dest_dir_symlinks ? stat : lstat) (file, &st) == 0
- ? 0 : errno);
+ int stat_result =
+ (dereference_dest_dir_symlinks ? stat (file, &st) : lstat (file, &st));
+ int err = (stat_result == 0 ? 0 : errno);
bool is_a_dir = !err && S_ISDIR (st.st_mode);
if (err && err != ENOENT)
error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
@@ -254,7 +255,7 @@ do_link (const char *source, const char *dest)
Try to unlink DEST even if we may have backed it up successfully.
In some unusual cases (when DEST and DEST_BACKUP are hard-links
that refer to the same file), rename succeeds and DEST remains.
- If we didn't remove DEST in that case, the subsequent LINKFUNC
+ If we didn't remove DEST in that case, the subsequent symlink or link
call would fail. */
if (!ok && errno == EEXIST && (remove_existing_files || dest_backup))