diff options
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.lib/wpad/wpa_supplicant.c | 30 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/in.routed/main.c | 41 | ||||
-rw-r--r-- | usr/src/cmd/rmvolmgr/rmvolmgr.c | 45 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/config.h | 3 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/daemon.h | 21 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/openbsd-compat.h | 1 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/Makefile.com | 3 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/common/daemon.c | 86 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat | 3 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libssh/common/llib-lssh | 3 |
10 files changed, 9 insertions, 227 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/wpad/wpa_supplicant.c b/usr/src/cmd/cmd-inet/usr.lib/wpad/wpa_supplicant.c index 4e3071debd..3fb8b133a7 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/wpad/wpa_supplicant.c +++ b/usr/src/cmd/cmd-inet/usr.lib/wpad/wpa_supplicant.c @@ -1,5 +1,5 @@ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -762,34 +762,6 @@ wpa_config_free(struct wpa_config *config) free(config); } -static int -daemon(boolean_t nochdir, boolean_t noclose) -{ - int retv; - - if ((retv = fork()) == -1) - return (-1); - if (retv != 0) - _exit(EXIT_SUCCESS); - if (setsid() == -1) - return (-1); - - if (!nochdir && chdir("/") == -1) - return (-1); - - if (!noclose) { - (void) close(0); - (void) close(1); - (void) close(2); - if ((retv = open("/dev/null", O_RDWR)) != -1) { - (void) dup2(retv, 1); - (void) dup2(retv, 2); - } - } - - return (0); -} - /* * make sure wpad is running under SMF context. */ diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/main.c b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/main.c index 0bbf016111..c37cf1caff 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/main.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright (c) 1983, 1988, 1993 @@ -38,8 +38,6 @@ * " The Regents of the University of California. All rights reserved.\n"; */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "defs.h" #include "pathnames.h" #include <signal.h> @@ -104,35 +102,6 @@ static void timevalsub(struct timeval *, struct timeval *, struct timeval *); static void sigalrm(int); static void sigterm(int); -static int -daemon(boolean_t nochdir, boolean_t noclose) -{ - int retv; - - if ((retv = fork()) == -1) - return (-1); - if (retv != 0) - _exit(EXIT_SUCCESS); - if (setsid() == -1) - return (-1); - if ((retv = fork()) == -1) - return (-1); - if (retv != 0) - _exit(EXIT_SUCCESS); - if (!nochdir && chdir("/") == -1) - return (-1); - if (!noclose) { - (void) close(0); - (void) close(1); - (void) close(2); - if ((retv = open("/dev/null", O_RDWR)) != -1) { - (void) dup2(retv, 1); - (void) dup2(retv, 2); - } - } - return (0); -} - int main(int argc, char *argv[]) { @@ -310,9 +279,9 @@ main(int argc, char *argv[]) goto usage; if (argc != 0) { usage: - (void) fprintf(stderr, - gettext("usage: in.routed [-AdghmnqsStVvz] " - "[-T <tracefile>]\n")); + (void) fprintf(stderr, gettext( + "usage: in.routed [-AdghmnqsStVvz] " + "[-T <tracefile>]\n")); (void) fprintf(stderr, gettext("\t[-F <net>[/<mask>][,<metric>]] [-P <parms>]\n")); logbad(_B_FALSE, gettext("excess arguments")); @@ -358,7 +327,7 @@ usage: msglog("signal: %s", rip_strerror(sigerr)); /* get into the background */ - if (background && daemon(_B_FALSE, _B_FALSE) < 0) + if (background && daemon(0, 0) < 0) BADERR(_B_FALSE, "daemon()"); /* Store our process id, blow away any existing file if it exists. */ diff --git a/usr/src/cmd/rmvolmgr/rmvolmgr.c b/usr/src/cmd/rmvolmgr/rmvolmgr.c index 3475066a97..3587d77dfd 100644 --- a/usr/src/cmd/rmvolmgr/rmvolmgr.c +++ b/usr/src/cmd/rmvolmgr/rmvolmgr.c @@ -74,7 +74,6 @@ static boolean_t opt_s; /* system instance */ static boolean_t rmm_prop_eject_button = B_TRUE; static void get_smf_properties(); -static int daemon(int nochdir, int noclose); static void rmm_device_added(LibHalContext *ctx, const char *udi); static void rmm_device_removed(LibHalContext *ctx, const char *udi); static void rmm_property_modified(LibHalContext *ctx, const char *udi, @@ -594,50 +593,6 @@ rmm_unmount_all() } } -static int -daemon(int nochdir, int noclose) -{ - int fd; - - switch (fork()) { - case -1: - return (-1); - case 0: - break; - default: - exit(0); - } - - if (setsid() == -1) - return (-1); - - if (!nochdir) - (void) chdir("/"); - - if (!noclose) { - struct stat64 st; - - if (((fd = open("/dev/null", O_RDWR, 0)) != -1) && - (fstat64(fd, &st) == 0)) { - if (S_ISCHR(st.st_mode) != 0) { - (void) dup2(fd, STDIN_FILENO); - (void) dup2(fd, STDOUT_FILENO); - (void) dup2(fd, STDERR_FILENO); - if (fd > 2) - (void) close(fd); - } else { - (void) close(fd); - (void) __set_errno(ENODEV); - return (-1); - } - } else { - (void) close(fd); - return (-1); - } - } - return (0); -} - int main(int argc, char **argv) { diff --git a/usr/src/cmd/ssh/include/config.h b/usr/src/cmd/ssh/include/config.h index 978559f2d0..8bf9962434 100644 --- a/usr/src/cmd/ssh/include/config.h +++ b/usr/src/cmd/ssh/include/config.h @@ -279,9 +279,6 @@ extern "C" { /* Define if your libraries define login() */ /* #undef HAVE_LOGIN */ -/* Define if your libraries define daemon() */ -/* #undef HAVE_DAEMON */ - /* Define if your libraries define getpagesize() */ #define HAVE_GETPAGESIZE 1 diff --git a/usr/src/cmd/ssh/include/daemon.h b/usr/src/cmd/ssh/include/daemon.h deleted file mode 100644 index fd22d587fd..0000000000 --- a/usr/src/cmd/ssh/include/daemon.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $Id: daemon.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */ - -#ifndef _DAEMON_H -#define _DAEMON_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "config.h" -#ifndef HAVE_DAEMON -int daemon(int nochdir, int noclose); -#endif /* !HAVE_DAEMON */ - -#ifdef __cplusplus -} -#endif - -#endif /* _DAEMON_H */ diff --git a/usr/src/cmd/ssh/include/openbsd-compat.h b/usr/src/cmd/ssh/include/openbsd-compat.h index df2472da0e..aab8e36c62 100644 --- a/usr/src/cmd/ssh/include/openbsd-compat.h +++ b/usr/src/cmd/ssh/include/openbsd-compat.h @@ -44,7 +44,6 @@ extern "C" { #include "strlcat.h" #include "strmode.h" #include "mktemp.h" -#include "daemon.h" #include "dirname.h" #include "base64.h" #include "sigact.h" diff --git a/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com b/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com index bfee4459c7..0b8ad1622b 100644 --- a/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com +++ b/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/ssh/libopenbsd-compat/Makefile.com @@ -41,7 +41,6 @@ OBJECTS = \ xmmap.o \ base64.o \ bindresvport.o \ - daemon.o \ dirname.o \ getcwd.o \ getgrouplist.o \ diff --git a/usr/src/cmd/ssh/libopenbsd-compat/common/daemon.c b/usr/src/cmd/ssh/libopenbsd-compat/common/daemon.c deleted file mode 100644 index a7e44333f0..0000000000 --- a/usr/src/cmd/ssh/libopenbsd-compat/common/daemon.c +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "includes.h" - -#ifndef HAVE_DAEMON - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: daemon.c,v 1.2 1996/08/19 08:22:13 tholo Exp $"; -#endif /* LIBC_SCCS and not lint */ - -int -daemon(nochdir, noclose) - int nochdir, noclose; -{ - int fd; - - switch (fork()) { - case -1: - return (-1); - case 0: -#ifdef HAVE_CYGWIN - register_9x_service(); -#endif - break; - default: -#ifdef HAVE_CYGWIN - /* - * This sleep avoids a race condition which kills the - * child process if parent is started by a NT/W2K service. - */ - sleep(1); -#endif - _exit(0); - } - - if (setsid() == -1) - return (-1); - - if (!nochdir) - (void)chdir("/"); - - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - (void)dup2(fd, STDIN_FILENO); - (void)dup2(fd, STDOUT_FILENO); - (void)dup2(fd, STDERR_FILENO); - if (fd > 2) - (void)close (fd); - } - return (0); -} - -#endif /* !HAVE_DAEMON */ - - -#pragma ident "%Z%%M% %I% %E% SMI" diff --git a/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat b/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat index 7d6ae70cda..3c5912997f 100644 --- a/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat +++ b/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat @@ -21,7 +21,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -38,7 +38,6 @@ #include <bsd-waitpid.h> #include <config.h> #include <crc32.h> -#include <daemon.h> #include <deattack.h> #include <defines.h> #include <dirname.h> diff --git a/usr/src/cmd/ssh/libssh/common/llib-lssh b/usr/src/cmd/ssh/libssh/common/llib-lssh index 3d8e8d5525..c44090abe6 100644 --- a/usr/src/cmd/ssh/libssh/common/llib-lssh +++ b/usr/src/cmd/ssh/libssh/common/llib-lssh @@ -21,7 +21,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -53,7 +53,6 @@ #include <compress.h> #include <config.h> #include <crc32.h> -#include <daemon.h> #include <deattack.h> #include <defines.h> #include <dh.h> |