diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-11-03 23:22:34 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-11-03 23:22:34 +0000 |
| commit | 4e65ab954d9ea762310495c1696231cb4262c86e (patch) | |
| tree | 98ca6a347728a727899dd793fd7cde4446e4fc49 /bin | |
| parent | c71f01affeb35e2f996feee126157d38beb6506d (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/getfacl/getfacl.1 | 2 | ||||
| -rw-r--r-- | bin/getfacl/getfacl.c | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/bin/getfacl/getfacl.1 b/bin/getfacl/getfacl.1 index aff3e939fabd9..291999a9bcc65 100644 --- a/bin/getfacl/getfacl.1 +++ b/bin/getfacl/getfacl.1 @@ -89,6 +89,8 @@ Retrieve ACL for the directory Retrieve the default ACL for the directory .Pa / , if any. +.Sh DIAGNOSTICS +.Ex -std .Sh SEE ALSO .Xr setfacl 1 , .Xr acl 3 , diff --git a/bin/getfacl/getfacl.c b/bin/getfacl/getfacl.c index 7becd17821605..22406d5706956 100644 --- a/bin/getfacl/getfacl.c +++ b/bin/getfacl/getfacl.c @@ -156,7 +156,7 @@ print_acl(char *path, acl_type_t type) error = stat(path, &sb); if (error == -1) { - perror(path); + warn("%s", path); return(-1); } @@ -178,14 +178,14 @@ print_acl(char *path, acl_type_t type) return(0); acl = acl_from_stat(sb); if (!acl) { - perror("acl_from_stat()"); + warn("acl_from_stat()"); return(-1); } } acl_text = acl_to_text(acl, 0); if (!acl_text) { - perror(path); + warn("%s", path); return(-1); } @@ -200,13 +200,12 @@ print_acl(char *path, acl_type_t type) static int print_acl_from_stdin(acl_type_t type) { - char pathname[PATH_MAX]; + char *p, pathname[PATH_MAX]; int carried_error = 0; - pathname[sizeof(pathname) - 1] = '\0'; while (fgets(pathname, (int)sizeof(pathname), stdin)) { - /* remove the \n */ - pathname[strlen(pathname) - 1] = '\0'; + if ((p = strchr(pathname, '\n')) != NULL) + *p = '\0'; if (print_acl(pathname, type) == -1) { carried_error = -1; } @@ -236,7 +235,7 @@ main(int argc, char *argv[]) if (argc == 0) { error = print_acl_from_stdin(type); - return(error); + return(error ? 1 : 0); } for (i = 0; i < argc; i++) { @@ -251,5 +250,5 @@ main(int argc, char *argv[]) } } - return(carried_error); + return(carried_error ? 1 : 0); } |
