From ff340cf167078ab69726093f8b5c5e508fd1edd0 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Fri, 16 Dec 2005 19:07:36 +0000 Subject: [PATCH] 2005-12-16 Robert Love * src/backends/NetworkManagerSuSE.c: Do not invoke ypbind or autofs binaries unless they exist (nm_spawn_process() emits a warning if asked to spawn a non-existant process). git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1205 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ src/backends/NetworkManagerSuSE.c | 33 +++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 081aac059e..81c27d6543 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-12-16 Robert Love + + * src/backends/NetworkManagerSuSE.c: Do not invoke ypbind or autofs + binaries unless they exist (nm_spawn_process() emits a warning if + asked to spawn a non-existant process). + 2005-12-16 Dan Williams * gnome/applet/applet-dbus-info.c diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index c533a2830f..59178cd80c 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -849,6 +849,8 @@ void nm_system_activate_nis (NMIP4Config *config) /* write out yp.conf and restart the daemon */ if (num_nis_servers > 0) { + struct stat sb; + ypconf = fopen ("/etc/yp.conf", "w"); if (ypconf) @@ -862,10 +864,17 @@ void nm_system_activate_nis (NMIP4Config *config) fclose (ypconf); } else nm_warning ("Could not commit NIS changes to /etc/yp.conf."); - nm_info ("Restarting ypbind."); - nm_spawn_process ("/usr/sbin/rcypbind restart"); - nm_info ("Restarting autofs."); - nm_spawn_process ("/usr/sbin/rcautofs restart"); + + if (stat ("/usr/sbin/rcypbind", &sb) != -1) + { + nm_info ("Restarting ypbind."); + nm_spawn_process ("/usr/sbin/rcypbind restart"); + } + if (stat ("/usr/sbin/rcautofs", &sb) != -1) + { + nm_info ("Restarting autofs."); + nm_spawn_process ("/usr/sbin/rcautofs restart"); + } } } @@ -878,8 +887,16 @@ void nm_system_activate_nis (NMIP4Config *config) */ void nm_system_shutdown_nis (void) { - nm_info ("Stopping ypbind."); - nm_spawn_process ("/usr/sbin/rcypbind stop"); - nm_info ("Restarting autofs."); - nm_spawn_process ("/usr/sbin/rcautofs restart"); + struct stat sb; + + if (stat ("/usr/sbin/rcypbind", &sb) != -1) + { + nm_info ("Stopping ypbind."); + nm_spawn_process ("/usr/sbin/rcypbind stop"); + } + if (stat ("/usr/sbin/rcautofs", &sb) != -1) + { + nm_info ("Restarting autofs."); + nm_spawn_process ("/usr/sbin/rcautofs restart"); + } }