aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-07-07 07:25:59 +0200
committerMattias Andrée <maandree@operamail.com>2015-07-07 07:25:59 +0200
commit4455b4ed119dfb6af23fb7b49423bb8c50921c63 (patch)
treee8494031e3a267fdb33bf642a8b6592206c1aa32 /src
parentfix error where mode_t argument was not added when O_CREAT was used in open (diff)
downloadmds-4455b4ed119dfb6af23fb7b49423bb8c50921c63.tar.gz
mds-4455b4ed119dfb6af23fb7b49423bb8c50921c63.tar.bz2
mds-4455b4ed119dfb6af23fb7b49423bb8c50921c63.tar.xz
resolve warning
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mds-base.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mds-base.c b/src/mds-base.c
index 2e6a3b1..79a3ba4 100644
--- a/src/mds-base.c
+++ b/src/mds-base.c
@@ -253,6 +253,8 @@ static int server_initialised_fork_for_safety(void)
int __attribute__((weak)) server_initialised(void)
{
pid_t r;
+ int saved_errno;
+
if (on_init_fork && (r = fork()))
{
fail_if (r == (pid_t)-1);
@@ -260,7 +262,23 @@ int __attribute__((weak)) server_initialised(void)
}
if (on_init_sh != NULL)
- system(on_init_sh);
+ if (system(on_init_sh) == -1)
+ {
+ saved_errno = errno;
+ if (system(NULL))
+ {
+ errno = 0;
+ eprint("no shell is available.");
+ return -1;
+ }
+ else
+ {
+ errno = saved_errno;
+ xperror(*argv);
+ eprint("while running shell at completed initialisation.");
+ return -1;
+ }
+ }
if (server_characteristics.fork_for_safety)
return server_initialised_fork_for_safety();