Skip to content

Commit

Permalink
Log and continue after errors setting utime
Browse files Browse the repository at this point in the history
  • Loading branch information
jaylevitt committed Nov 30, 2008
1 parent 73c01cd commit 7440e6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 3 additions & 1 deletion ometastore.ml
Expand Up @@ -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

Expand Down
18 changes: 5 additions & 13 deletions ometastore_stub.c
Expand Up @@ -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));
}
Expand All @@ -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");
}

Expand Down

0 comments on commit 7440e6a

Please sign in to comment.