mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
daemon/selinux-relabel: search for "invalid option" in setfiles output
'X' in the setiles' stderr doesn't necessarily mean that option 'X' doesn't exist. For instance, when passing '-T' we get: "setfiles: option requires an argument -- 'T'". Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
This commit is contained in:
committed by
Richard W.M. Jones
parent
9ced5fac8c
commit
152d6e4bdf
@@ -56,8 +56,9 @@ setfiles_has_option (int *flag, char opt_char)
|
||||
|
||||
if (*flag == -1) {
|
||||
char option[] = { '-', opt_char, '\0' }; /* "-X" */
|
||||
char err_opt[] = { '\'', opt_char, '\'', '\0'}; /* "'X'" */
|
||||
char err_opt[32]; /* "invalid option -- 'X'" */
|
||||
|
||||
snprintf(err_opt, sizeof(err_opt), "invalid option -- '%c'", opt_char);
|
||||
ignore_value (command (NULL, &err, "setfiles", option, NULL));
|
||||
*flag = err && strstr (err, /* "invalid option -- " */ err_opt) == NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user