aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-03-17 19:40:57 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-03-17 19:40:57 +0530
commitf2ee21cdcd2d1309b9443fcb19cdc515c768e5c3 (patch)
tree53c9bf062fea6f45b84525847d323157333ff589 /src/nnn.c
parent4fc8d1edd18d758c6cf43e5b936ab23fe7b5579a (diff)
downloadnnn-f2ee21cdcd2d1309b9443fcb19cdc515c768e5c3.tar.gz
checkpatch warning fixes
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 87a3e4c..7efaf37 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1004,7 +1004,7 @@ static int parseargs(char *line, char **argv)
}
++line;
- }
+ }
return count;
}
@@ -1039,7 +1039,8 @@ static void join(pid_t p, uchar flag)
if (!(flag & F_NOWAIT))
/* wait for the child to exit */
- while (waitpid(p, &status, 0) == -1);
+ do {
+ } while (waitpid(p, &status, 0) == -1);
/* restore parent's signal handling */
signal(SIGHUP, oldsighup);
@@ -1068,9 +1069,10 @@ static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar fla
if (flag & F_MULTI) {
size_t len = strlen(file) + 1;
+
cmd = (char *)malloc(len);
if (!cmd) {
- DPRINTF_S("spawn: malloc()!");
+ DPRINTF_S("malloc()!");
return;
}
@@ -1078,7 +1080,7 @@ static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar fla
status = parseargs(cmd, argv);
if (status == -1 || status > (EXEC_ARGS_MAX - 3)) { /* arg1, arg2 and last NULL */
free(cmd);
- DPRINTF_S("spawn: NULL or too many args");
+ DPRINTF_S("NULL or too many args");
return;
}
@@ -3176,11 +3178,11 @@ nochange:
r = cfg.curctx;
if (fd == '>' || fd == '.')
do
- r = (r + 1) & ~CTX_MAX;
+ r = (r + 1) & ~CTX_MAX;
while (!g_ctx[r].c_cfg.ctxactive);
else
do
- r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1);
+ r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1);
while (!g_ctx[r].c_cfg.ctxactive); // fallthrough
fd = '1' + r; // fallthrough
case '1': // fallthrough
@@ -3923,7 +3925,8 @@ nochange:
fd = cfg.curctx;
for (r = (fd + 1) & ~CTX_MAX;
(r != fd) && !g_ctx[r].c_cfg.ctxactive;
- r = ((r + 1) & ~CTX_MAX));
+ r = ((r + 1) & ~CTX_MAX)) {
+ };
if (r != fd) {
g_ctx[fd].c_cfg.ctxactive = 0;
@@ -4154,8 +4157,11 @@ int main(int argc, char *argv[])
g_tmpfplen = xstrlcpy(g_tmpfpath, home, HOME_LEN_MAX);
else if (xdiraccess("/tmp"))
g_tmpfplen = xstrlcpy(g_tmpfpath, "/tmp", HOME_LEN_MAX);
- else if ((copier = getenv("TMPDIR")) != NULL)
- g_tmpfplen = xstrlcpy(g_tmpfpath, copier, HOME_LEN_MAX);
+ else {
+ copier = getenv("TMPDIR");
+ if (copier != NULL)
+ g_tmpfplen = xstrlcpy(g_tmpfpath, copier, HOME_LEN_MAX);
+ }
if (!cfg.picker && g_tmpfplen) {
xstrlcpy(g_cppath, g_tmpfpath, PATH_MAX);