mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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.
This commit is contained in:
1 parent
5fb93f635b
commit
64a212cb75
3 files changed
+18
-17
No files matched your search
+6
-5
@@ -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)
|
||||
{
|
||||
|
||||
+6
-6
@@ -77,7 +77,6 @@ main (int argc, char **argv)
|
||||
int exit_status = EXIT_SUCCESS;
|
||||
int optc;
|
||||
security_context_t scontext = NULL;
|
||||
int ret = 0;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -112,16 +111,17 @@ 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));
|
||||
}
|
||||
|
||||
newmode = MODE_RW_UGO;
|
||||
if (specified_mode)
|
||||
|
||||
+6
-6
@@ -94,7 +94,6 @@ main (int argc, char **argv)
|
||||
int expected_operands;
|
||||
mode_t node_type;
|
||||
security_context_t scontext = NULL;
|
||||
int ret = 0;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -168,16 +167,17 @@ 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));
|
||||
}
|
||||
|
||||
/* Only check the first character, to allow mnemonic usage like
|
||||
'mknod /dev/rst0 character 18 0'. */
|
||||
|
||||
Reference in new issue
Block a user