Address lint reports

This commit is contained in:
Arun Prakash Jana 2024-09-24 16:56:11 +05:30
parent 2bb76a0e38
commit e7b0974551
No known key found for this signature in database
GPG key ID: 4A865183AF6C5631

View file

@ -1235,7 +1235,7 @@ static char *abspath(const char *filepath, char *cwd, char *buf)
cwd = home; cwd = home;
path += 2; /* advance 2 bytes past the "~/" */ path += 2; /* advance 2 bytes past the "~/" */
} else if ((path[0] != '/') && !cwd) { } else if ((path[0] != '/') && !cwd) {
cwd = getcwd(NULL, 0); cwd = getcwd(NULL, 0); // NOLINT
if (!cwd) if (!cwd)
return NULL; return NULL;
allocated = TRUE; allocated = TRUE;
@ -2474,7 +2474,7 @@ static int spawn(char *file, char *arg1, char *arg2, char *arg3, ushort_t flag)
if (flag & F_NOSTDIN) if (flag & F_NOSTDIN)
dup2(fd, STDIN_FILENO); dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO); dup2(fd, STDOUT_FILENO); // NOLINT
dup2(fd, STDERR_FILENO); dup2(fd, STDERR_FILENO);
close(fd); close(fd);
} else if (flag & F_TTY) { } else if (flag & F_TTY) {
@ -4781,7 +4781,7 @@ static bool handle_archive(char *fpath /* in-out param */, char op)
return FALSE; return FALSE;
} }
/* Copy the new dir path to open it in smart context */ /* Copy the new dir path to open it in smart context */
outdir = getcwd(NULL, 0); outdir = getcwd(NULL, 0); // NOLINT
x_to = TRUE; x_to = TRUE;
} }
} }
@ -6829,7 +6829,7 @@ static bool browse(char *ipath, const char *session, int pkey)
/* If the initial path is a file, retain a way to return to start dir */ /* If the initial path is a file, retain a way to return to start dir */
if (g_state.initfile) { if (g_state.initfile) {
free(initpath); free(initpath);
initpath = ipath = getcwd(NULL, 0); initpath = ipath = getcwd(NULL, 0); // NOLINT
} }
path = g_ctx[0].c_path; /* current directory */ path = g_ctx[0].c_path; /* current directory */
@ -8577,7 +8577,7 @@ int main(int argc, char *argv[])
mmask_t mask; mmask_t mask;
char *middle_click_env = xgetenv(env_cfg[NNN_MCLICK], "\0"); char *middle_click_env = xgetenv(env_cfg[NNN_MCLICK], "\0");
middle_click_key = (middle_click_env[0] == '^' && middle_click_env[1]) middle_click_key = ((middle_click_env[0] == '^') && middle_click_env[1])
? CONTROL(middle_click_env[1]) ? CONTROL(middle_click_env[1])
: (uchar_t)middle_click_env[0]; : (uchar_t)middle_click_env[0];
#endif #endif
@ -8828,7 +8828,7 @@ int main(int argc, char *argv[])
/* Start in the current directory */ /* Start in the current directory */
char *startpath = getenv("PWD"); char *startpath = getenv("PWD");
initpath = (startpath && *startpath) ? xstrdup(startpath) : getcwd(NULL, 0); initpath = (startpath && *startpath) ? xstrdup(startpath) : getcwd(NULL, 0); // NOLINT
if (!initpath) if (!initpath)
initpath = "/"; initpath = "/";
} else { /* Open a file */ } else { /* Open a file */