summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/rcmdsh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/rcmdsh.c')
-rw-r--r--src/lib/libc/net/rcmdsh.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libc/net/rcmdsh.c b/src/lib/libc/net/rcmdsh.c
index fe49a5a21b..39338c2c74 100644
--- a/src/lib/libc/net/rcmdsh.c
+++ b/src/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rcmdsh.c,v 1.2 1996/09/01 20:28:22 millert Exp $ */ 1/* $OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $ */
2 2
3/* 3/*
4 * This is an rcmd() replacement originally by 4 * This is an rcmd() replacement originally by
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8#if defined(LIBC_SCCS) && !defined(lint) 8#if defined(LIBC_SCCS) && !defined(lint)
9static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.2 1996/09/01 20:28:22 millert Exp $"; 9static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $";
10#endif /* LIBC_SCCS and not lint */ 10#endif /* LIBC_SCCS and not lint */
11 11
12#include <sys/types.h> 12#include <sys/types.h>
@@ -19,17 +19,19 @@ static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.2 1996/09/01 20:28:22 millert Exp $
19#include <string.h> 19#include <string.h>
20#include <pwd.h> 20#include <pwd.h>
21#include <paths.h> 21#include <paths.h>
22#include <unistd.h>
22 23
23/* 24/*
24 * This is a replacement rcmd() function that uses the rsh(1) 25 * This is a replacement rcmd() function that uses the rsh(1)
25 * program in place of a direct rcmd(3) function call so as to 26 * program in place of a direct rcmd(3) function call so as to
26 * avoid having to be root. Note that rport is ignored. 27 * avoid having to be root. Note that rport is ignored.
27 */ 28 */
29/* ARGSUSED */
28int 30int
29rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog) 31rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog)
30 char **ahost; 32 char **ahost;
31 u_short rport; 33 int rport;
32 char *locuser, *remuser, *cmd; 34 const char *locuser, *remuser, *cmd;
33 char *rshprog; 35 char *rshprog;
34{ 36{
35 struct hostent *hp; 37 struct hostent *hp;
@@ -109,12 +111,12 @@ rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog)
109 (void) fprintf(stderr, "rcmdsh: execlp %s failed: %s\n", 111 (void) fprintf(stderr, "rcmdsh: execlp %s failed: %s\n",
110 rshprog, strerror(errno)); 112 rshprog, strerror(errno));
111 _exit(255); 113 _exit(255);
112 } else if (cpid > 0) { 114 } else {
113 /* Parent. close sp[1], return sp[0]. */ 115 /* Parent. close sp[1], return sp[0]. */
114 (void) close(sp[1]); 116 (void) close(sp[1]);
115 /* Reap child. */ 117 /* Reap child. */
116 (void) wait(NULL); 118 (void) wait(NULL);
117 return(sp[0]); 119 return(sp[0]);
118 } 120 }
119 /*NOTREACHED*/ 121 /* NOTREACHED */
120} 122}