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

Re: [busybox/utility.c:recursiveAction] ? - followLinks, stat, lstat



>>>>> "Adam" == Adam Di Carlo <adam@onshore.com> writes:

    Adam> karlheg@bittersweet.inetarena.com (Karl M. Hegbloom) writes:
    >> Tell me if I'm wrong... but:
    >> 
    >> 8<------------------------------------------------------------>8
    >> if (followLinks == TRUE) status = stat (fileName, &statbuf);
    >> else status = lstat (fileName, &statbuf);
    >> 
    >> /* ####? -karlheg status = lstat (fileName, &statbuf); */
    >> 8<------------------------------------------------------------>8
    >> 

    Adam> I can't really tell what you're asking.. can't your thoughts
    Adam> be expressed as a proper diff ?

 Sure, I'm sorry.  I thought you'd look at the actual code file,
 locate the function, and see that I'd commented off the line with the
 "####?"  in it...


 Notice how it checks `followLinks', then uses either `stat' or
 `lstat', but then right after that, uses `lstat', returning to the
 same return variable and same statbuf.  I believe this is an error or
 an artifact of some kind, and that the attached diff should be
 applied.


    Before
8<------------------------------------------------------->8
    if (followLinks == TRUE)
        status = stat (fileName, &statbuf);
    else
        status = lstat (fileName, &statbuf);

    status = lstat(fileName, &statbuf);
    if (status < 0) {
        perror (fileName);
        return (FALSE);
    }
8<------------------------------------------------------->8

   After
8<------------------------------------------------------->8
    if (followLinks == TRUE)
        status = stat (fileName, &statbuf);
    else
        status = lstat (fileName, &statbuf);

    if (status < 0) {
        perror (fileName);
        return (FALSE);
    }
8<------------------------------------------------------->8


% cvs diff -w utility.c
Index: utility.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/busybox/utility.c,v
retrieving revision 1.30
diff -u -w -r1.30 utility.c
--- utility.c	2000/01/23 02:13:50	1.30
+++ utility.c	2000/01/25 07:00:37
@@ -406,7 +406,6 @@
     else
 	status = lstat(fileName, &statbuf);
 
-    status = lstat(fileName, &statbuf);
     if (status < 0) {
 	perror(fileName);
 	return (FALSE);
Exit Status: [0]


Reply to: