changeset: 2018:7f9a3280f8de
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Thu Mar 15 19:01:58 2007 -0400
summary: Set argv[0] to the - followed by the basename of the login shell.
diff -r 850990f7c859 -r 7f9a3280f8de fs.c
--- a/fs.c Thu Mar 15 17:36:21 2007 -0400
+++ b/fs.c Thu Mar 15 19:01:58 2007 -0400
@@ -239,13 +239,15 @@ message_root(char *message)
else if(!strncmp(message, "exec ", 5)) {
srv.running = 0;
execstr = strdup(&message[5]);
+ message += strlen(message);
}
else if(!strncmp(message, "view ", 5))
select_view(&message[5]);
else if(!strncmp(message, "selcolors ", 10)) {
fprintf(stderr, "wmiiwm: warning: selcolors have been removed\n");
return Ebadcmd;
- }else if(!strncmp(message, "focuscolors ", 12)) {
+ }
+ else if(!strncmp(message, "focuscolors ", 12)) {
message += 12;
n = strlen(message);
return parse_colors(&message, (int *)&n, &def.focuscolor);
diff -r 850990f7c859 -r 7f9a3280f8de main.c
--- a/main.c Thu Mar 15 17:36:21 2007 -0400
+++ b/main.c Thu Mar 15 19:01:58 2007 -0400
@@ -387,10 +387,12 @@ main(int argc, char *argv[]) {
/* Run through the user's shell as a login shell */
tmp = malloc(sizeof(char*) * (strlen(passwd->pw_shell) + 2));
- /* Can't overflow */
- sprintf(tmp, "-%s", passwd->pw_shell);
+ if(passwd->pw_shell[0] == '/')
+ sprintf(tmp, "-%s", strrchr(passwd->pw_shell, '/') + 1); /* Can't overflow */
+ else
+ fatal("wmiiwm: shell is not an absolute path: %s\n", passwd->pw_shell);
+
execl(passwd->pw_shell, tmp, "-c", wmiirc, nil);
-
fatal("wmiiwm: can't exec \"%s\": %s\n", wmiirc, strerror(errno));
break; /* Not reached */
default:
@@ -432,8 +434,8 @@ main(int argc, char *argv[]) {
num_screens = 1;
screens = emallocz(num_screens * sizeof(*screens));
- for(sock = 0; sock < num_screens; sock++) {
- s = &screens[sock];
+ for(i = 0; i < num_screens; i++) {
+ s = &screens[i];
s->lbar = nil;
s->rbar = nil;
s->sel = nil;
Received on Fri Mar 16 2007 - 00:06:37 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:18 UTC