diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-07-02 11:53:57 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-07-02 11:54:49 +0200 |
commit | 64a212cb75f78b60440efeed2de6461ed1f88ae8 (patch) | |
tree | ca8debfdaeb3dcb44def17447f957822160affd7 /src/mkdir.c | |
parent | 5fb93f635b935ea5632e36600e07a2c5fc5bad5e (diff) | |
download | coreutils-64a212cb75f78b60440efeed2de6461ed1f88ae8.tar.xz |
mkdir,mkfifo,mknod: give scontext-related variable a better scope
* src/mkdir.c (main): Move the variable ret and issuing the error
message into the body of the scontext-related if-block.
* src/mkfifo.c (main): Likewise.
* src/mknod.c (main): Likewise.
Diffstat (limited to 'src/mkdir.c')
-rw-r--r-- | src/mkdir.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mkdir.c b/src/mkdir.c index 479faca85..efd318497 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -152,7 +152,6 @@ main (int argc, char **argv) int optc; security_context_t scontext = NULL; struct mkdir_options options; - int ret = 0; options.make_ancestor_function = NULL; options.mode = S_IRWXUGO; @@ -198,16 +197,18 @@ main (int argc, char **argv) if (scontext) { + int ret = 0; if (is_smack_enabled ()) ret = smack_set_label_for_self (scontext); else ret = setfscreatecon (scontext); + + if (ret < 0) + error (EXIT_FAILURE, errno, + _("failed to set default file creation context to %s"), + quote (scontext)); } - if (ret < 0) - error (EXIT_FAILURE, errno, - _("failed to set default file creation context to %s"), - quote (scontext)); if (options.make_ancestor_function || specified_mode) { |