Skip to content

Commit 5ade862

Browse files
paskyPetr Baudis
authored andcommitted
[PATCH] nsec portability
It seems like the nsec portability is limited; in particular, older glibcs (<=2.2.4 at least) don't seem to like it. So access the nsec fields in struct stat only when -DNSEC. Signed-off-by: Petr Baudis <[email protected]>
1 parent aebb267 commit 5ade862

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

update-cache.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ static int index_fd(const char *path, int namelen, struct cache_entry *ce, int f
6969
static void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
7070
{
7171
ce->ctime.sec = st->st_ctime;
72+
#ifdef NSEC
7273
ce->ctime.nsec = st->st_ctim.tv_nsec;
74+
#endif
7375
ce->mtime.sec = st->st_mtime;
76+
#ifdef NSEC
7477
ce->mtime.nsec = st->st_mtim.tv_nsec;
78+
#endif
7579
ce->st_dev = st->st_dev;
7680
ce->st_ino = st->st_ino;
7781
ce->st_uid = st->st_uid;

0 commit comments

Comments
 (0)