diff options
author | Elliott Hughes <enh@google.com> | 2015-07-01 14:56:07 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-07-01 14:56:07 -0500 |
commit | 8c0d2d2bc557ced86650ab48ab92cf58840efce8 (patch) | |
tree | b5781eb790c0c54198b9bea417be2886c46091fa /toys/posix | |
parent | 56217bb175cdf9506b9b7970edd313c1fef8e122 (diff) | |
download | toybox-8c0d2d2bc557ced86650ab48ab92cf58840efce8.tar.gz |
Improve -Z error reporting.
The most likely reason for setfscreatecon to fail is that you don't have permission, and that's reported by the write return EACCES. There isn't really a "bad" context; they're just strings.
Before:
$ adb shell mkdir -Z x y
mkdir: bad -Z 'x'
After:
$ adb shell mkdir -Z x y
mkdir: -Z 'x' failed: Permission denied
Other than this, the ToT mkdir works fine with SELinux.
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/mkdir.c | 2 | ||||
-rw-r--r-- | toys/posix/mkfifo.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/mkdir.c b/toys/posix/mkdir.c index 438e38ea..95bdf333 100644 --- a/toys/posix/mkdir.c +++ b/toys/posix/mkdir.c @@ -43,7 +43,7 @@ void mkdir_main(void) if (CFG_MKDIR_Z && (toys.optflags&FLAG_Z)) if (0>lsm_set_create(TT.arg_context)) - error_exit("bad -Z '%s'", TT.arg_context); + perror_exit("-Z '%s' failed", TT.arg_context); if (TT.arg_mode) mode = string_to_mode(TT.arg_mode, 0777); diff --git a/toys/posix/mkfifo.c b/toys/posix/mkfifo.c index 7bc43cce..9aa3a3ae 100644 --- a/toys/posix/mkfifo.c +++ b/toys/posix/mkfifo.c @@ -43,7 +43,7 @@ void mkfifo_main(void) if (CFG_MKFIFO_Z && (toys.optflags&FLAG_Z)) if (0>lsm_set_create(TT.Z)) - error_exit("bad -Z '%s'", TT.Z); + perror_exit("-Z '%s' failed", TT.Z); for (s = toys.optargs; *s; s++) if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) perror_msg("%s", *s); |