mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Remove incorrect cast in kbfunc_exec. In kbfunc_ssh, reverse logic on
truncation check so it's obvious.
This commit is contained in:
parent
d27fc99784
commit
26b95de019
8
kbfunc.c
8
kbfunc.c
@ -281,8 +281,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
|||||||
(void)memset(tpath, '\0', sizeof(tpath));
|
(void)memset(tpath, '\0', sizeof(tpath));
|
||||||
l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i],
|
l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i],
|
||||||
dp->d_name);
|
dp->d_name);
|
||||||
/* check for truncation etc */
|
if (l == -1 || l >= sizeof(tpath))
|
||||||
if (l == -1 || l >= (int)sizeof(tpath))
|
|
||||||
continue;
|
continue;
|
||||||
if (access(tpath, X_OK) == 0)
|
if (access(tpath, X_OK) == 0)
|
||||||
menuq_add(&menuq, NULL, "%s", dp->d_name);
|
menuq_add(&menuq, NULL, "%s", dp->d_name);
|
||||||
@ -373,8 +372,9 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
|||||||
goto out;
|
goto out;
|
||||||
l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s",
|
l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s",
|
||||||
cmd->path, mi->text, mi->text);
|
cmd->path, mi->text, mi->text);
|
||||||
if (l != -1 && l < sizeof(path))
|
if (l == -1 || l >= sizeof(path))
|
||||||
u_spawn(path);
|
goto out;
|
||||||
|
u_spawn(path);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (mi != NULL && mi->dummy)
|
if (mi != NULL && mi->dummy)
|
||||||
|
Loading…
Reference in New Issue
Block a user