restorecond fixes:
Stop using depracated g_io interfaces Exit with non zero exit code if wrong options given Add -h option
This commit is contained in:
parent
68264eb77e
commit
acc953768b
@ -42,11 +42,42 @@ index 99d0ed7..19e20a8 100644
|
|||||||
if (set_signal_handles())
|
if (set_signal_handles())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
diff --git a/policycoreutils/restorecond/restorecond.8 b/policycoreutils/restorecond/restorecond.8
|
||||||
|
index 4622d2b..bf8ec87 100644
|
||||||
|
--- a/policycoreutils/restorecond/restorecond.8
|
||||||
|
+++ b/policycoreutils/restorecond/restorecond.8
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
restorecond \- daemon that watches for file creation and then sets the default SELinux file context
|
||||||
|
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
-.B restorecond [\-d] [\-f restorecond_file ] [\-u] [\-v]
|
||||||
|
+.B restorecond [\-d] [-h] [\-f restorecond_file ] [\-u] [\-v]
|
||||||
|
.P
|
||||||
|
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
@@ -20,6 +20,9 @@ the correct file context associated with the policy.
|
||||||
|
Turns on debugging mode. Application will stay in the foreground and lots of
|
||||||
|
debugs messages start printing.
|
||||||
|
.TP
|
||||||
|
+. B \-h
|
||||||
|
+Print usage statement.
|
||||||
|
+.TP
|
||||||
|
.B \-f restorecond_file
|
||||||
|
Use alternative restorecond.conf file.
|
||||||
|
.TP
|
||||||
diff --git a/policycoreutils/restorecond/restorecond.c b/policycoreutils/restorecond/restorecond.c
|
diff --git a/policycoreutils/restorecond/restorecond.c b/policycoreutils/restorecond/restorecond.c
|
||||||
index 89f5d97..dfd9629 100644
|
index 89f5d97..1762850 100644
|
||||||
--- a/policycoreutils/restorecond/restorecond.c
|
--- a/policycoreutils/restorecond/restorecond.c
|
||||||
+++ b/policycoreutils/restorecond/restorecond.c
|
+++ b/policycoreutils/restorecond/restorecond.c
|
||||||
@@ -140,6 +140,7 @@ int main(int argc, char **argv)
|
@@ -121,7 +121,6 @@ static void term_handler()
|
||||||
|
static void usage(char *program)
|
||||||
|
{
|
||||||
|
printf("%s [-d] [-f restorecond_file ] [-u] [-v] \n", program);
|
||||||
|
- exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void exitApp(const char *msg)
|
||||||
|
@@ -140,6 +139,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
@ -54,7 +85,7 @@ index 89f5d97..dfd9629 100644
|
|||||||
|
|
||||||
memset(&r_opts, 0, sizeof(r_opts));
|
memset(&r_opts, 0, sizeof(r_opts));
|
||||||
|
|
||||||
@@ -160,6 +161,7 @@ int main(int argc, char **argv)
|
@@ -160,6 +160,7 @@ int main(int argc, char **argv)
|
||||||
r_opts.fts_flags = FTS_PHYSICAL;
|
r_opts.fts_flags = FTS_PHYSICAL;
|
||||||
r_opts.selabel_opt_validate = NULL;
|
r_opts.selabel_opt_validate = NULL;
|
||||||
r_opts.selabel_opt_path = NULL;
|
r_opts.selabel_opt_path = NULL;
|
||||||
@ -62,6 +93,58 @@ index 89f5d97..dfd9629 100644
|
|||||||
r_opts.ignore_enoent = 1;
|
r_opts.ignore_enoent = 1;
|
||||||
|
|
||||||
restore_init(&r_opts);
|
restore_init(&r_opts);
|
||||||
|
@@ -176,7 +177,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
|
exclude_non_seclabel_mounts();
|
||||||
|
atexit( done );
|
||||||
|
- while ((opt = getopt(argc, argv, "df:uv")) > 0) {
|
||||||
|
+ while ((opt = getopt(argc, argv, "hdf:uv")) > 0) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'd':
|
||||||
|
debug_mode = 1;
|
||||||
|
@@ -187,11 +188,16 @@ int main(int argc, char **argv)
|
||||||
|
case 'u':
|
||||||
|
run_as_user = 1;
|
||||||
|
break;
|
||||||
|
+ case 'h':
|
||||||
|
+ usage(argv[0]);
|
||||||
|
+ exit(0);
|
||||||
|
+ break;
|
||||||
|
case 'v':
|
||||||
|
r_opts.verbose++;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
usage(argv[0]);
|
||||||
|
+ exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/policycoreutils/restorecond/user.c b/policycoreutils/restorecond/user.c
|
||||||
|
index 4257058..f3e431e 100644
|
||||||
|
--- a/policycoreutils/restorecond/user.c
|
||||||
|
+++ b/policycoreutils/restorecond/user.c
|
||||||
|
@@ -118,10 +118,10 @@ io_channel_callback
|
||||||
|
|
||||||
|
if (condition & G_IO_IN) {
|
||||||
|
/* Data is available. */
|
||||||
|
- g_io_channel_read
|
||||||
|
+ g_io_channel_read_chars
|
||||||
|
(source, buffer,
|
||||||
|
sizeof (buffer),
|
||||||
|
- &bytes_read);
|
||||||
|
+ &bytes_read, NULL);
|
||||||
|
|
||||||
|
if (! bytes_read) {
|
||||||
|
/* Sesssion/Terminal Ended */
|
||||||
|
@@ -152,7 +152,7 @@ io_channel_callback
|
||||||
|
file. */
|
||||||
|
|
||||||
|
if (condition & G_IO_HUP) {
|
||||||
|
- g_io_channel_close (source);
|
||||||
|
+ g_io_channel_shutdown (source, 0, NULL);
|
||||||
|
exit(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c
|
diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c
|
||||||
index 9db766c..92034be 100644
|
index 9db766c..92034be 100644
|
||||||
--- a/policycoreutils/run_init/run_init.c
|
--- a/policycoreutils/run_init/run_init.c
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Summary: SELinux policy core utilities
|
Summary: SELinux policy core utilities
|
||||||
Name: policycoreutils
|
Name: policycoreutils
|
||||||
Version: 2.1.10
|
Version: 2.1.10
|
||||||
Release: 10%{?dist}
|
Release: 11%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
# Based on git repository with tag 20101221
|
# Based on git repository with tag 20101221
|
||||||
@ -355,6 +355,12 @@ fi
|
|||||||
/bin/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jan 24 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.10-11
|
||||||
|
- restorecond fixes:
|
||||||
|
Stop using depracated g_io interfaces
|
||||||
|
Exit with non zero exit code if wrong options given
|
||||||
|
Add -h option
|
||||||
|
|
||||||
* Thu Jan 19 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.10-10
|
* Thu Jan 19 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.10-10
|
||||||
- Eliminate not needed Requires
|
- Eliminate not needed Requires
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user