diff --git a/ometastore.ml b/ometastore.ml index 9107e9c..2193a62 100644 --- a/ometastore.ml +++ b/ometastore.ml @@ -273,7 +273,9 @@ let apply_change = function printf "%s: file type of changed (nothing done)\n" e1.path; if !use_mtime && e1.mtime <> e2.mtime then begin out "%s: mtime set to %.0f\n" e1.path e2.mtime; - utime e2.path (Nativeint.of_float e2.mtime) + try + utime e2.path (Nativeint.of_float e2.mtime) + with Failure _ -> ( out "utime failed: %s\n" e1.path ) end; if !use_xattrs && e1.xattrs <> e2.xattrs then fix_xattrs e1 e2 diff --git a/ometastore_stub.c b/ometastore_stub.c index c9c6e41..016d62d 100644 --- a/ometastore_stub.c +++ b/ometastore_stub.c @@ -46,8 +46,10 @@ CAMLprim value perform_utime(value file, value time) tbuf.actime = Nativeint_val(time); tbuf.modtime = Nativeint_val(time); - if(utime(String_val(file), &tbuf)) - caml_failwith("utime"); + if(utime(String_val(file), &tbuf)) { + printf("utime on %s to %d failed, error %i: %s\n", file, Nativeint_val(time), errno, strerror(errno)); + caml_failwith("utime"); + } return(Val_int(0)); } @@ -65,17 +67,7 @@ CAMLprim value perform_llistxattr(value file) if (siz == 0 || errno == EPERM || errno == EACCES) CAMLreturn(Val_int(0)); if(siz < 0) { - printf("Running llistxattr on %s failed, error %i\n", file, errno); - if (errno == ENOTSUP) printf("Not supported on file system.\n"); - if (errno == ERANGE) printf("Namebuf too small.\n"); - if (errno == EPERM) printf("Not supported on file.\n"); - if (errno == ENOTDIR) printf("Path not a directory.\n"); - if (errno == ENAMETOOLONG) printf("Name too long.\n"); - if (errno == EACCES) printf("Permission denied.\n"); - if (errno == ELOOP) printf("Too many symbolic links. Loop?\n"); - if (errno == EFAULT) printf("Inavlid address.\n"); - if (errno == EIO) printf("I/O error occured.\n"); - if (errno == EINVAL) printf("Options invalid.\n"); + printf("llistxattr on %s failed, error %i: %s\n", file, errno, strerror(errno)); caml_failwith("llistxattr"); }