=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- src/usr.bin/tmux/cmd.c 2011/04/05 19:37:01 1.52 +++ src/usr.bin/tmux/cmd.c 2011/04/06 21:51:31 1.53 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.52 2011/04/05 19:37:01 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.53 2011/04/06 21:51:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -725,6 +725,12 @@ if (arglen != 0 && tmparg[arglen - 1] == ':') tmparg[arglen - 1] = '\0'; + /* An empty session name is the current session. */ + if (*tmparg == '\0') { + xfree (tmparg); + return (cmd_current_session(ctx, prefer_unattached)); + } + /* Find the session, if any. */ s = cmd_lookup_session(tmparg, &ambiguous); @@ -840,7 +846,7 @@ lookup_session: if (ambiguous) goto not_found; - if ((s = cmd_lookup_session(arg, &ambiguous)) == NULL) + if (*arg != '\0' && (s = cmd_lookup_session(arg, &ambiguous)) == NULL) goto no_session; if (sp != NULL) @@ -981,7 +987,7 @@ lookup_session: if (ambiguous) goto not_found; - if ((s = cmd_lookup_session(arg, &ambiguous)) == NULL) + if (*arg != '\0' && (s = cmd_lookup_session(arg, &ambiguous)) == NULL) goto no_session; if (sp != NULL)