diff options
author | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-06-11 05:46:21 +0000 |
---|---|---|
committer | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-06-11 05:46:21 +0000 |
commit | c1ec42d4fc9e3a14b6c8e9981939244d85fe72ee (patch) | |
tree | ec712d77f97b9aa3bee68f7d2b09196840257780 /usr.bin | |
parent | a2669e57d8eea99200c70040b5e592ed45d3efd7 (diff) |
pid_t cleanup. Markus need this now to keep hacking.
markus@, millert@ ok
Note: big usr.bin/ cleanup is comming. Now I'm waiting Ok from espie@ for
make/.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/auth-krb4.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/monitor.h | 4 | ||||
-rw-r--r-- | usr.bin/ssh/serverloop.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/session.c | 28 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-agent.c | 14 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 10 |
6 files changed, 35 insertions, 33 deletions
diff --git a/usr.bin/ssh/auth-krb4.c b/usr.bin/ssh/auth-krb4.c index 2a3cf53146e..1cc528aa0a9 100644 --- a/usr.bin/ssh/auth-krb4.c +++ b/usr.bin/ssh/auth-krb4.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth-krb4.c,v 1.26 2002/03/18 01:30:10 dugsong Exp $"); +RCSID("$OpenBSD: auth-krb4.c,v 1.27 2002/06/11 05:46:20 mpech Exp $"); #include "ssh.h" #include "ssh1.h" @@ -57,8 +57,8 @@ krb4_init(void *context) if (lstat("/ticket", &st) != -1) tkt_root = "/ticket/"; #endif /* AFS */ - snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%d", - tkt_root, authctxt->pw->pw_uid, getpid()); + snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%ld", + tkt_root, authctxt->pw->pw_uid, (long)getpid()); krb_set_tkt_string(authctxt->krb4_ticket_file); } /* Register ticket cleanup in case of fatal error. */ diff --git a/usr.bin/ssh/monitor.h b/usr.bin/ssh/monitor.h index 9b9f21d6fa0..42d5237e646 100644 --- a/usr.bin/ssh/monitor.h +++ b/usr.bin/ssh/monitor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.h,v 1.5 2002/06/06 01:09:41 stevesk Exp $ */ +/* $OpenBSD: monitor.h,v 1.6 2002/06/11 05:46:20 mpech Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> @@ -59,7 +59,7 @@ struct monitor { struct mm_master *m_zback; struct mm_master *m_zlib; struct Kex **m_pkex; - int m_pid; + pid_t m_pid; }; struct monitor *monitor_init(void); diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c index 8046cd53472..b72c921d98b 100644 --- a/usr.bin/ssh/serverloop.c +++ b/usr.bin/ssh/serverloop.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $"); +RCSID("$OpenBSD: serverloop.c,v 1.102 2002/06/11 05:46:20 mpech Exp $"); #include "xmalloc.h" #include "packet.h" @@ -674,8 +674,8 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) if (errno != EINTR) packet_disconnect("wait: %.100s", strerror(errno)); if (wait_pid != pid) - error("Strange, wait returned pid %d, expected %d", - wait_pid, pid); + error("Strange, wait returned pid %ld, expected %ld", + (long)wait_pid, (long)pid); /* Check if it exited normally. */ if (WIFEXITED(wait_status)) { diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c index 809483fdbe0..4837b1d9423 100644 --- a/usr.bin/ssh/session.c +++ b/usr.bin/ssh/session.c @@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.136 2002/06/10 22:28:41 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.137 2002/06/11 05:46:20 mpech Exp $"); #include "ssh.h" #include "ssh1.h" @@ -149,8 +149,8 @@ auth_input_request_forwarding(struct passwd * pw) auth_sock_dir = NULL; return 0; } - snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%d", - auth_sock_dir, (int) getpid()); + snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%ld", + auth_sock_dir, (long) getpid()); /* delete agent socket on fatal() */ fatal_add_cleanup(auth_sock_cleanup_proc, pw); @@ -414,7 +414,7 @@ do_authenticated1(Authctxt *authctxt) void do_exec_no_pty(Session *s, const char *command) { - int pid; + pid_t pid; #ifdef USE_PIPES int pin[2], pout[2], perr[2]; @@ -1234,12 +1234,12 @@ session_dump(void) int i; for (i = 0; i < MAX_SESSIONS; i++) { Session *s = &sessions[i]; - debug("dump: used %d session %d %p channel %d pid %d", + debug("dump: used %d session %d %p channel %d pid %ld", s->used, s->self, s, s->chanid, - s->pid); + (long)s->pid); } } @@ -1297,13 +1297,13 @@ static Session * session_by_pid(pid_t pid) { int i; - debug("session_by_pid: pid %d", pid); + debug("session_by_pid: pid %ld", (long)pid); for (i = 0; i < MAX_SESSIONS; i++) { Session *s = &sessions[i]; if (s->used && s->pid == pid) return s; } - error("session_by_pid: unknown pid %d", pid); + error("session_by_pid: unknown pid %ld", (long)pid); session_dump(); return NULL; } @@ -1593,8 +1593,8 @@ session_exit_message(Session *s, int status) if ((c = channel_lookup(s->chanid)) == NULL) fatal("session_exit_message: session %d: no channel %d", s->self, s->chanid); - debug("session_exit_message: session %d channel %d pid %d", - s->self, s->chanid, s->pid); + debug("session_exit_message: session %d channel %d pid %ld", + s->self, s->chanid, (long)s->pid); if (WIFEXITED(status)) { channel_request_start(s->chanid, "exit-status", 0); @@ -1629,7 +1629,7 @@ session_exit_message(Session *s, int status) void session_close(Session *s) { - debug("session_close: session %d pid %d", s->self, s->pid); + debug("session_close: session %d pid %ld", s->self, (long)s->pid); if (s->ttyfd != -1) { fatal_remove_cleanup(session_pty_cleanup, (void *)s); session_pty_cleanup(s); @@ -1653,7 +1653,8 @@ session_close_by_pid(pid_t pid, int status) { Session *s = session_by_pid(pid); if (s == NULL) { - debug("session_close_by_pid: no session for pid %d", pid); + debug("session_close_by_pid: no session for pid %ld", + (long)pid); return; } if (s->chanid != -1) @@ -1673,7 +1674,8 @@ session_close_by_channel(int id, void *arg) debug("session_close_by_channel: no session for id %d", id); return; } - debug("session_close_by_channel: channel %d child %d", id, s->pid); + debug("session_close_by_channel: channel %d child %ld", + id, (long)s->pid); if (s->pid != 0) { debug("session_close_by_channel: channel %d: has child", id); /* diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c index 27c1c5d079a..d3da35e4075 100644 --- a/usr.bin/ssh/ssh-agent.c +++ b/usr.bin/ssh/ssh-agent.c @@ -35,7 +35,7 @@ #include "includes.h" #include <sys/queue.h> -RCSID("$OpenBSD: ssh-agent.c,v 1.90 2002/06/09 13:32:01 markus Exp $"); +RCSID("$OpenBSD: ssh-agent.c,v 1.91 2002/06/11 05:46:20 mpech Exp $"); #include <openssl/evp.h> #include <openssl/md5.h> @@ -1026,7 +1026,7 @@ main(int ac, char **av) format = c_flag ? "unsetenv %s;\n" : "unset %s;\n"; printf(format, SSH_AUTHSOCKET_ENV_NAME); printf(format, SSH_AGENTPID_ENV_NAME); - printf("echo Agent pid %d killed;\n", pid); + printf("echo Agent pid %ld killed;\n", (long)pid); exit(0); } parent_pid = getpid(); @@ -1038,8 +1038,8 @@ main(int ac, char **av) perror("mkdtemp: private socket dir"); exit(1); } - snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir, - parent_pid); + snprintf(socket_name, sizeof socket_name, "%s/agent.%ld", socket_dir, + (long)parent_pid); } else { /* Try to use specified agent socket */ socket_dir[0] = '\0'; @@ -1076,7 +1076,7 @@ main(int ac, char **av) format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n"; printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, SSH_AUTHSOCKET_ENV_NAME); - printf("echo Agent pid %d;\n", parent_pid); + printf("echo Agent pid %ld;\n", (long)parent_pid); goto skip; } pid = fork(); @@ -1086,14 +1086,14 @@ main(int ac, char **av) } if (pid != 0) { /* Parent - execute the given command. */ close(sock); - snprintf(pidstrbuf, sizeof pidstrbuf, "%d", pid); + snprintf(pidstrbuf, sizeof pidstrbuf, "%ld", (long)pid); if (ac == 0) { format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n"; printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, SSH_AUTHSOCKET_ENV_NAME); printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf, SSH_AGENTPID_ENV_NAME); - printf("echo Agent pid %d;\n", pid); + printf("echo Agent pid %ld;\n", (long)pid); exit(0); } if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 || diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 42f2422aa7b..22d08a0e8ab 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -42,7 +42,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.244 2002/05/29 11:21:57 markus Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.245 2002/06/11 05:46:20 mpech Exp $"); #include <openssl/dh.h> #include <openssl/bn.h> @@ -561,7 +561,7 @@ privsep_preauth(void) if (pid == -1) { fatal("fork of unprivileged child failed"); } else if (pid != 0) { - debug2("Network child is on pid %d", pid); + debug2("Network child is on pid %ld", (long)pid); close(pmonitor->m_recvfd); authctxt = monitor_child_preauth(pmonitor); @@ -617,7 +617,7 @@ privsep_postauth(Authctxt *authctxt) if (pmonitor->m_pid == -1) fatal("fork of unprivileged child failed"); else if (pmonitor->m_pid != 0) { - debug2("User child is on pid %d", pmonitor->m_pid); + debug2("User child is on pid %ld", (long)pmonitor->m_pid); close(pmonitor->m_recvfd); monitor_child_postauth(pmonitor); @@ -1131,7 +1131,7 @@ main(int ac, char **av) */ f = fopen(options.pid_file, "w"); if (f) { - fprintf(f, "%u\n", (u_int) getpid()); + fprintf(f, "%ld\n", (long) getpid()); fclose(f); } } @@ -1278,7 +1278,7 @@ main(int ac, char **av) if (pid < 0) error("fork: %.100s", strerror(errno)); else - debug("Forked child %d.", pid); + debug("Forked child %ld.", (long)pid); close(startup_p[1]); |