diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-06-25 15:58:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-06-25 15:58:33 +0000 |
commit | 0e95769b435d1e21859efce6c1687e4343090ffc (patch) | |
tree | 5c2a789f1e1373c2c3c9f7a3b685a89ee86b1d7d /client.c | |
parent | b9155e835a56b4301fc22c4aa7e05457e13144d8 (diff) | |
download | rtmux-0e95769b435d1e21859efce6c1687e4343090ffc.tar.gz rtmux-0e95769b435d1e21859efce6c1687e4343090ffc.tar.bz2 rtmux-0e95769b435d1e21859efce6c1687e4343090ffc.zip |
Call setproctitle earlier in the client, and include the socket name. Makes it
easier to match client to server in ps/pgrep when using several servers.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.48 2009-05-13 23:27:00 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.2 2009/06/05 07:15:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -46,6 +46,15 @@ client_init(char *path, struct client_ctx *cctx, int start_server, int flags) int mode; struct buffer *b; char *name; +#ifdef HAVE_SETPROCTITLE + char rpathbuf[MAXPATHLEN]; +#endif + +#ifdef HAVE_SETPROCTITLE + if (realpath(path, rpathbuf) == NULL) + strlcpy(rpathbuf, path, sizeof rpathbuf); + setproctitle("client (%s)", rpathbuf); +#endif if (lstat(path, &sb) != 0) { if (start_server && errno == ENOENT) { @@ -135,9 +144,6 @@ client_main(struct client_ctx *cctx) siginit(); logfile("client"); -#ifdef HAVE_SETPROCTITLE - setproctitle("client"); -#endif error = NULL; xtimeout = INFTIM; |