#define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atim.tv_nsec)
#define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctim.tv_nsec)
#define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtim.tv_nsec)
+#define ST_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtim.tv_nsec = (val)
#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
/* macOS */
#define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atimensec)
#define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctimensec)
#define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtimensec)
+#define ST_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtimensec = (val)
#else
#define ST_ATIM_NSEC(stbuf) 0
#define ST_CTIM_NSEC(stbuf) 0
#define ST_MTIM_NSEC(stbuf) 0
+#define ST_MTIM_NSEC_SET(stbuf, val) do { } while (0)
#endif
#define __erofs_likely(x) __builtin_expect(!!(x), 1)
ret = -EIO;
goto out;
}
-#if ST_MTIM_NSEC
- ST_MTIM_NSEC(&eh->st) = n;
-#endif
+ ST_MTIM_NSEC_SET(&eh->st, n);
+ } else {
+ ST_MTIM_NSEC_SET(&eh->st, 0);
}
eh->use_mtime = true;
} else if (!strncmp(kv, "size=",
if (eh.use_mtime) {
st.st_mtime = eh.st.st_mtime;
-#if ST_MTIM_NSEC
- ST_MTIM_NSEC(&st) = ST_MTIM_NSEC(&eh.st);
-#endif
+ ST_MTIM_NSEC_SET(&st, ST_MTIM_NSEC(&eh.st));
} else {
st.st_mtime = tarerofs_parsenum(th->mtime, sizeof(th->mtime));
if (errno)
goto invalid_tar;
+ ST_MTIM_NSEC_SET(&st, 0);
}
if (th->typeflag <= '7' && !eh.path) {