summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2008-06-07 05:12:04 +0200
committerMikael Magnusson <mikachu@gmail.com>2008-10-27 00:55:16 +0100
commit8f37a97a4cc29d35f6a632ef2f71ac760e301ee5 (patch)
tree32a5ac3aa7b8044ef01cdea94ca0140e4ddaff93
parentd81d54c7a977a034199f24fc8fa7433e634aaf91 (diff)
The code to replace $wid/$pid died on $foo.
It failed to increment a variable after finding a $ but no pid or wid, which led to a fun infinite loop. Also don't check if c[1] is w if we already established it was p.
-rw-r--r--openbox/actions/execute.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c
index 121c0943..376eee53 100644
--- a/openbox/actions/execute.c
+++ b/openbox/actions/execute.c
@@ -144,7 +144,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
if (data->client) {
gchar *c, *before, *expand;
- /* replace occurances of $pid and $wid */
+ /* replace occurrences of $pid and $wid */
expand = NULL;
before = cmd;
@@ -168,8 +168,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
before = c + 4; /* 4 = strlen("$pid") */
}
-
- if ((c[1] == 'w' || c[1] == 'W') &&
+ else if ((c[1] == 'w' || c[1] == 'W') &&
(c[2] == 'i' || c[2] == 'I') &&
(c[3] == 'd' || c[3] == 'D') &&
!g_ascii_isalnum(c[4]))
@@ -187,6 +186,8 @@ static gboolean run_func(ObActionsData *data, gpointer options)
before = c + 4; /* 4 = strlen("$wid") */
}
+ else
+ before = c + 1; /* no infinite loops plz */
}
if (expand) {