summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-05-14 07:04:42 +0000
committermidipix <writeonce@midipix.org>2020-05-14 07:18:54 +0000
commit9325bd5003e5baa238c2e4dc2a9989e9f835b79c (patch)
treec80f7ed2e3899d480be77f4ca20501ae449c2360
parentba22ee0406ef2e31c7b004b353ebc47812b45281 (diff)
downloadntux-9325bd5003e5baa238c2e4dc2a9989e9f835b79c.tar.bz2
ntux-9325bd5003e5baa238c2e4dc2a9989e9f835b79c.tar.xz
ntux_cmd_chmod(): properly set errno upon non-system-call failure.
-rw-r--r--src/cmds/ntux_cmd_chmod.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/cmds/ntux_cmd_chmod.c b/src/cmds/ntux_cmd_chmod.c
index b90acfe..be93f83 100644
--- a/src/cmds/ntux_cmd_chmod.c
+++ b/src/cmds/ntux_cmd_chmod.c
@@ -155,9 +155,10 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit)
NT_FILE_SHARE_READ
| NT_FILE_SHARE_WRITE
| NT_FILE_SHARE_DELETE)))
- return ntux_cmd_chmod_ret(
- fd,ofd,0,
- NTUX_SYSTEM_ERROR(dctx));
+ if (ntux_errno_set(dctx,EACCES))
+ return ntux_cmd_chmod_ret(
+ fd,ofd,0,
+ NTUX_SYSTEM_ERROR(dctx));
/* srcsd */
srcsd = (nt_sd *)buf;
@@ -168,16 +169,18 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit)
| NT_GROUP_SECURITY_INFORMATION
| NT_DACL_SECURITY_INFORMATION,
srcsd,sizeof(buf),&size)))
- return ntux_cmd_chmod_ret(
- fd,ofd,hasync,
- NTUX_SYSTEM_ERROR(dctx));
+ if (ntux_errno_set(dctx,ENXIO))
+ return ntux_cmd_chmod_ret(
+ fd,ofd,hasync,
+ NTUX_SYSTEM_ERROR(dctx));
if ((status = __xfi_acl_init_common_descriptor_meta(
&meta,srcsd,
NT_ACL_INIT_COMMON_DESCRIPTION_META_STRICT_MODE)))
- return ntux_cmd_chmod_ret(
- fd,ofd,hasync,
- NTUX_SYSTEM_ERROR(dctx));
+ if (ntux_errno_set(dctx,EBADF))
+ return ntux_cmd_chmod_ret(
+ fd,ofd,hasync,
+ NTUX_SYSTEM_ERROR(dctx));
/* source permissions */
access_owner = meta.owner_ace ? meta.owner_ace->mask : 0;
@@ -208,9 +211,10 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit)
if ((status = __xfi_set_security_object(
hasync,sec_mask,&dstsd.sd)))
- return ntux_cmd_chmod_ret(
- fd,ofd,hasync,
- NTUX_SYSTEM_ERROR(dctx));
+ if (ntux_errno_set(dctx,EPERM))
+ return ntux_cmd_chmod_ret(
+ fd,ofd,hasync,
+ NTUX_SYSTEM_ERROR(dctx));
/* changes */
(void)fdout;