summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-08-03 18:17:21 +0000
committerJakub Jelinek <jakub@redhat.com>2006-08-03 18:17:21 +0000
commit98d2266156a49df5f93726c8f0b148bbdee41c9d (patch)
treeede2fc481a291b776b9db4f7b1183afea1158b9d
parent6e3ba1514c3973dc55f6c16cb737dc3624d6837f (diff)
redirect /sbin/service sshd condrestart std{out,err} to /dev/null when executed from glibc_post_upgrade
-rw-r--r--fedora/glibc.spec.in2
-rw-r--r--fedora/glibc_post_upgrade.c17
2 files changed, 17 insertions, 2 deletions
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 72089575e1..67a6b71b7e 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1439,6 +1439,8 @@ rm -f *.filelist*
%changelog
- fix memusage and xtrace scripts (#200736)
+- redirect /sbin/service sshd condrestart std{out,err} to /dev/null
+ when executed from glibc_post_upgrade
* Wed Aug 2 2006 Jakub Jelinek <jakub@redhat.com> 2.4.90-17
- typo fix for the dladdr patch
diff --git a/fedora/glibc_post_upgrade.c b/fedora/glibc_post_upgrade.c
index d33d6775df..cde931bde3 100644
--- a/fedora/glibc_post_upgrade.c
+++ b/fedora/glibc_post_upgrade.c
@@ -145,7 +145,7 @@ main (void)
&& access ("/bin/bash", X_OK) == 0)
{
if (check_elf ("/usr/sbin/sshd"))
- verbose_exec (121, "/sbin/service", "/sbin/service", "sshd", "condrestart");
+ verbose_exec (-121, "/sbin/service", "/sbin/service", "sshd", "condrestart");
}
_exit(0);
@@ -210,10 +210,23 @@ vexec (int failcode, char *const path[])
{
pid_t pid;
int status, save_errno;
+ int devnull = 0;
+ if (failcode < 0)
+ {
+ devnull = 1;
+ failcode = -failcode;
+ }
pid = vfork ();
if (pid == 0)
- {
+ {
+ int fd;
+ if (devnull && (fd = open ("/dev/null", O_WRONLY)) >= 0)
+ {
+ dup2 (fd, 1);
+ dup2 (fd, 2);
+ close (fd);
+ }
execv (path[0], path + 1);
save_errno = errno;
message (path);