bug#1059: [BusyBox] bug#1059: ls exit status patch for bb v0.47

David Douthitt ssrat at mailbag.com
Wed Oct 11 15:32:07 UTC 2000


On 11 Oct 2000, at 15:11, Kent Robotti wrote:

> This is just for bb v0.47 so the correct
> exit status is returned for ls.
> 
> It's ls.c from the latest cvs bb + the ls
> exit status patch #3 from bug1047 in this 
> list. 

# patch -p0 < ls.c.diff
patching file `ls.c'
Hunk #5 FAILED at 795.
Hunk #6 succeeded at 863 (offset 10 lines).
1 out of 6 hunks FAILED -- saving rejects to ls.c.rej
# cat ls.c.rej
***************
*** 790,800 ****
        for (oi=0 ; oi < ac; oi++) {
                cur= (struct dnode *)xmalloc(sizeof(struct dnode));
                cur->fullname= xstrdup(av[oi]);
-               cur->name= cur->fullname ;
                if (lstat(av[oi], &cur->dstat)) {  /* get file info 
into node */
                        errorMsg("%s: %s\n", av[oi], strerror(errno));
                        free(cur->fullname);
                        free(cur);
                        continue;
                }
                cur->next= dn;
--- 795,817 ----
        for (oi=0 ; oi < ac; oi++) {
                cur= (struct dnode *)xmalloc(sizeof(struct dnode));
                cur->fullname= xstrdup(av[oi]);
+               cur->name= cur->fullname;
+ #ifdef BB_FEATURE_LS_FOLLOWLINKS
+               if (follow_links == TRUE) {
+                       if (stat(av[oi], &cur->dstat)) {
+                               errorMsg("%s: %s\n", av[oi], 
strerror(errno));
+                               free(cur->fullname);
+                               free(cur);
+                               status = EXIT_FAILURE;
+                               continue;
+                       }
+               } else
+ #endif
                if (lstat(av[oi], &cur->dstat)) {  /* get file info 
into node */
                        errorMsg("%s: %s\n", av[oi], strerror(errno));
                        free(cur->fullname);
                        free(cur);
+                       status = EXIT_FAILURE;
                        continue;
                }
                cur->next= dn;
#
-- 
David Douthitt
UNIX Systems Administrator
HP-UX, Linux, Unixware
ddouthitt at mennonite.minister.net






More information about the busybox mailing list