bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link -L/-P


From: Pádraig Brady
Subject: Re: link -L/-P
Date: Fri, 25 Sep 2009 11:11:24 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Eric Blake wrote:
> According to Pádraig Brady on 9/24/2009 5:13 PM:
>> Eric Blake wrote:
> 
>>> +  -L, --logical               make hard links to symbolic link 
>>> references\n\
>> s/references/targets/ is a bit clearer to me?
> 
> I thought about that, but we already specify:
> 
> ln source target
> 
> as the synopsis, so I didn't want to confuse target (the file being
> created) with target (the contents of the symlink being linked through).
> 
>>> +  -P, --physical              make hard links directly to symblic links\n\
>> s/symblic/symbolic/
> 
> Thanks.  I folded that in, then added a patch to fix copy.c to use linkat
> (pushed).  I also noticed a cleanup for stdbuf while searching through
> instances of 'link (', although I haven't been able to test that yet,
> since stdbuf doesn't compile on cygwin.  I've pushed my work to:
> 
> git pull git://repo.or.cz/coreutils/ericb.git master
> 
> to make it easier to review.
> 

You need to chmod a+x ln/hard-to-sym

Also your stdbuf cleanup needs the following.
(I was wary about passing NULL into access())

cheers,
Pádraig.

diff --git a/bootstrap.conf b/bootstrap.conf
index f648e22..475ed8f 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -43,6 +43,7 @@ gnulib_modules="
   acl
   alloca
   announce-gen
+  areadlink
   areadlink-with-size
   argmatch
   argv-iter
diff --git a/src/stdbuf.c b/src/stdbuf.c
index c33cdfa..383003c 100644
--- a/src/stdbuf.c
+++ b/src/stdbuf.c
@@ -28,6 +28,8 @@
 #include "quote.h"
 #include "xstrtol.h"
 #include "c-ctype.h"
+#include "areadlink.h"
+#include "filenamecat.h"

 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "stdbuf"
@@ -154,8 +156,8 @@ set_program_path (const char *arg)
           path = xstrdup (path);
           for (dir = strtok (path, ":"); dir != NULL; dir = strtok (NULL, ":"))
             {
-              char *candidate = file_name_concat (dir, arg);
-              if (access (candidate, X_OK) == 0)
+              char *candidate = file_name_concat (dir, arg, NULL);
+              if (candidate && access (candidate, X_OK) == 0)
                 {
                   program_path = dir_name (candidate);
                   free (candidate);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]