diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-23 10:48:23 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-23 10:48:23 +0000 |
commit | 688a487570e39312c39d7a46e0a7ed6e61392ee8 (patch) | |
tree | ed01d3073c1decf05b67adc25a19b0901d16d1e9 /server-fn.c | |
parent | 21c17da7e6f4631dc418a7b1768d217ce1ccae2f (diff) | |
download | rtmux-688a487570e39312c39d7a46e0a7ed6e61392ee8.tar.gz rtmux-688a487570e39312c39d7a46e0a7ed6e61392ee8.tar.bz2 rtmux-688a487570e39312c39d7a46e0a7ed6e61392ee8.zip |
Lift last MAXNAMELEN limit on -s argument.
Diffstat (limited to 'server-fn.c')
-rw-r--r-- | server-fn.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/server-fn.c b/server-fn.c index 65a4ab99..74f07a0e 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.21 2007-10-19 10:21:35 nicm Exp $ */ +/* $Id: server-fn.c,v 1.22 2007-10-23 10:48:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -23,33 +23,33 @@ #include "tmux.h" -/* Find session from sessid. */ +/* Find session from command message. */ struct session * -server_find_sessid(struct sessid *sid, char **cause) +server_extract_session(struct msg_command_data *data, char *name, char **cause) { struct session *s; u_int i, n; - if (*sid->name != '\0') { - sid->name[(sizeof sid->name) - 1] = '\0'; - if ((s = session_find(sid->name)) == NULL) { - xasprintf(cause, "session not found: %s", sid->name); + if (name != NULL) { + if ((s = session_find(name)) == NULL) { + xasprintf(cause, "session not found: %s", name); return (NULL); } return (s); } - if (sid->pid != -1) { - if (sid->pid != getpid()) { - xasprintf(cause, "wrong server: %lld", sid->pid); + if (data->pid != -1) { + if (data->pid != getpid()) { + xasprintf(cause, "wrong server: %lld", data->pid); return (NULL); } - if (sid->idx > ARRAY_LENGTH(&sessions)) { - xasprintf(cause, "index out of range: %u", sid->idx); + if (data->idx > ARRAY_LENGTH(&sessions)) { + xasprintf(cause, "index out of range: %u", data->idx); return (NULL); } - if ((s = ARRAY_ITEM(&sessions, sid->idx)) == NULL) { - xasprintf(cause, "session doesn't exist: %u", sid->idx); + if ((s = ARRAY_ITEM(&sessions, data->idx)) == NULL) { + xasprintf( + cause, "session doesn't exist: %u", data->idx); return (NULL); } return (s); |