]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
FreeBSD bug 204157: If filesystem does not support birthtime, then make all birthtim...
authorTim Kientzle <kientzle@gmail.com>
Fri, 24 Jun 2016 05:16:03 +0000 (22:16 -0700)
committerTim Kientzle <kientzle@gmail.com>
Fri, 24 Jun 2016 05:16:03 +0000 (22:16 -0700)
This is a bit of a hack:  We should also have tests that verify
different birthtimes.  When/if that happens, we'll need to add
a real system probe to determine whether birthtime is actually
supported on this particular filesystem and skip tests accordingly.

libarchive/test/main.c

index 0f50e940c9c6774131a9b8db720c44332485e95a..7c266857be905845298fe481c29e6d4953cb6127 100644 (file)
@@ -1292,6 +1292,11 @@ assertion_file_time(const char *file, int line,
        switch (type) {
        case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
        case 'b': filet = st.st_birthtime;
+               /* FreeBSD filesystems that don't support birthtime
+                * (e.g., UFS1) always return -1 here. */
+               if (filet == -1) {
+                       return (1);
+               }
                filet_nsec = st.st_birthtimespec.tv_nsec; break;
        case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
        default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);