summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/daemon.c')
-rw-r--r--libglusterfs/src/daemon.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/libglusterfs/src/daemon.c b/libglusterfs/src/daemon.c
index a6476ec2e..348e3ad40 100644
--- a/libglusterfs/src/daemon.c
+++ b/libglusterfs/src/daemon.c
@@ -1,20 +1,11 @@
/*
- Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
+ Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
*/
#include <fcntl.h>
@@ -29,7 +20,6 @@ os_daemon_return (int nochdir, int noclose)
int ret = -1;
FILE *ptr = NULL;
-
ret = fork();
if (ret)
return ret;
@@ -46,8 +36,16 @@ os_daemon_return (int nochdir, int noclose)
if (!noclose) {
ptr = freopen (DEVNULLPATH, "r", stdin);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stdout);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stderr);
+ if (!ptr)
+ goto out;
}
ret = 0;