https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222698

--- Comment #4 from Conrad Meyer <c...@freebsd.org> ---
This change ought to be sufficient to fix -newer:

--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -1201,6 +1201,7 @@ c_newer(OPTION *option, char ***argvp)
        char *fn_or_tspec;
        PLAN *new;
        struct stat sb;
+       int error;

        fn_or_tspec = nextarg(option, argvp);
        ftsoptions &= ~FTS_NOSTAT;
@@ -1214,7 +1215,11 @@ c_newer(OPTION *option, char ***argvp)
                /* Use the seconds only in the comparison. */
                new->t_data.tv_nsec = 999999999;
        } else {
-               if (stat(fn_or_tspec, &sb))
+               if (ftsoptions & FTS_PHYSICAL)
+                       error = lstat(fn_or_tspec, &sb);
+               else
+                       error = stat(fn_or_tspec, &sb);
+               if (error != 0)
                        err(1, "%s", fn_or_tspec);
                if (option->flags & F_TIME2_C)
                        new->t_data = sb.st_ctim;


However, -samefile is similarly broken.  Here's a patch for that part:

--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -1066,12 +1066,17 @@ c_samefile(OPTION *option, char ***argvp)
        char *fn;
        PLAN *new;
        struct stat sb;
+       int error;

        fn = nextarg(option, argvp);
        ftsoptions &= ~FTS_NOSTAT;

        new = palloc(option);
-       if (stat(fn, &sb))
+       if (ftsoptions & FTS_PHYSICAL)
+               error = lstat(fn, &sb);
+       else
+               error = stat(fn, &sb);
+       if (error != 0)
                err(1, "%s", fn);
        new->i_data = sb.st_ino;
        return new;

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to