lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Unfortunately, lfs CVS version (src/lfs.c revision 1.60) does not compile under
Linux Ubuntu-9.04 (jaunty) x86, kernel 2.6.28, gcc-4.3.3, glibc-2.9.

src/lfs.c: In function ʽlfs_lock_dirʼ:
src/lfs.c:278: error: ʽstruct statʼ has no member named ʽst_mtimespecʼ
gcc -O2 -I/pkg/lua-5.1.4.LR2/include -c src/lfs.c -o src/lfs.o

Error: Build error: Build error

Indeed, neither /usr/include/sys/stat.h nor /usr/include/bits/stat.h define
st_mtimespec member of struct stat. POSIX compliant name should be st_mtime.

Simple patch below fixed the problem for me.

--Leo--

--------%<--------%<--------%<--------
diff --git a/src/lfs.c b/src/lfs.c
index 13562ee..d96ca38 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -275,7 +275,7 @@ static int lfs_lock_dir(lua_State *L) {
   while(symlink(tmpln, ln) == -1) {
     if(errno == EEXIST) {
       if(lstat(ln, &statbuf) == -1) goto fail;
-      if(time(NULL) - statbuf.st_mtimespec.tv_sec > expires) {
+      if(time(NULL) - statbuf.st_mtime > expires) {
 		unlink(ln);
 		continue;
       }
-------->%-------->%-------->%--------