diff options
author | okan <okan> | 2014-09-11 16:06:26 +0000 |
---|---|---|
committer | okan <okan> | 2014-09-11 16:06:26 +0000 |
commit | 26b95de0194865a3638689d48e61221f90b9b73b (patch) | |
tree | 87d3ca1fbbe166aa79d0ce6f37dc8626a8a46fa9 /kbfunc.c | |
parent | d27fc997848f2c48bbf3b18bab6de7cd1b2b8b5d (diff) | |
download | cwm-26b95de0194865a3638689d48e61221f90b9b73b.tar.gz cwm-26b95de0194865a3638689d48e61221f90b9b73b.tar.xz cwm-26b95de0194865a3638689d48e61221f90b9b73b.zip |
Remove incorrect cast in kbfunc_exec. In kbfunc_ssh, reverse logic on
truncation check so it's obvious.
Diffstat (limited to 'kbfunc.c')
-rw-r--r-- | kbfunc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kbfunc.c b/kbfunc.c index 8c7d85a..f5d4d08 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -281,8 +281,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) (void)memset(tpath, '\0', sizeof(tpath)); l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i], dp->d_name); - /* check for truncation etc */ - if (l == -1 || l >= (int)sizeof(tpath)) + if (l == -1 || l >= sizeof(tpath)) continue; if (access(tpath, X_OK) == 0) menuq_add(&menuq, NULL, "%s", dp->d_name); @@ -373,8 +372,9 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) goto out; l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s", cmd->path, mi->text, mi->text); - if (l != -1 && l < sizeof(path)) - u_spawn(path); + if (l == -1 || l >= sizeof(path)) + goto out; + u_spawn(path); } out: if (mi != NULL && mi->dummy) |