[Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2004-09-29 23:17:46
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29006 Modified Files: fs_native.c Log Message: Fix arguments to SYS_utimes, which takes a struct timeval array instead of a struct utimebuf. Possibly fixes: Cray New_SPR_730100 SN: UTIME() SETS FILES LAST MODIFICATION TIME INTO THE FUTURE Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -w -b -B -p -r1.49 -r1.50 --- fs_native.c 21 Sep 2004 16:26:59 -0000 1.49 +++ fs_native.c 29 Sep 2004 23:17:18 -0000 1.50 @@ -57,6 +57,7 @@ #include <errno.h> #include <assert.h> #include <syscall.h> +#include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/fcntl.h> @@ -182,8 +183,14 @@ do { #if defined(USE_NATIVE_UTIME) #define __SYS_UTIME SYS_utimes +#define __TIME_BUF(x) struct timeval x##[2] +#define __SET_AT(x,y) (x)[0].tv_sec = (y) +#define __SET_MT(x,y) (x)[1].tv_sec = (y) #else #define __SYS_UTIME SYS_utime +#define __TIME_BUF(x) struct utimbuf x +#define __SET_AT(x,y) (x).actime = (y) +#define __SET_MT(x,y) (x).modtime = (y) #endif /* @@ -792,17 +799,17 @@ native_inop_setattr(struct pnode *pno, if (err) mask &= ~SETATTR_MODE; else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; + __TIME_BUF(ut); /* * Alter access and/or modify time attributes. */ - ut.actime = stat->st_atime; - ut.modtime = stat->st_mtime; + __SET_AT(ut, stat->st_atime); + __SET_MT(ut, stat->st_mtime); if (mask & SETATTR_MTIME) - ut.modtime = stat->st_mtime; + __SET_MT(ut, stat->st_mtime); if (mask & SETATTR_ATIME) - ut.actime = stat->st_atime; + __SET_AT(ut, stat->st_atime); err = syscall(__SYS_UTIME, path, &ut); if (err) err = -errno; @@ -871,10 +878,10 @@ native_inop_setattr(struct pnode *pno, : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; + __TIME_BUF(ut); - ut.actime = ino->i_stbuf.st_atime; - ut.modtime = ino->i_stbuf.st_mtime; + __SET_AT(ut, ino->i_stbuf.st_atime); + __SET_MT(ut, ino->i_stbuf.st_mtime); (void )syscall(__SYS_UTIME, path, &ut); } if (mask & SETATTR_MODE) { @@ -1026,7 +1033,7 @@ native_getdirentries(struct inode *ino, ldp = (struct linux_dirent *)bp; d64p = (struct dirent64 *)buf; for (;;) { - if (cc < 0 || (size_t )cc <= sizeof(*ldp)) + if (cc < 0 || (size_t )cc < sizeof(*ldp)) break; namlen = strlen(ldp->ld_name); reclen = sizeof(*d64p) - sizeof(d64p->d_name) + namlen + 1; |