mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Fix compilation issues with -O3 optimization.
This commit is contained in:
parent
bc731cd9c0
commit
8cb25227b3
16
noice.c
16
noice.c
|
@ -118,7 +118,7 @@ dprintf(int fd, const char *fmt, ...)
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
r = vsnprintf(buf, sizeof(buf), fmt, ap);
|
r = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
if (r > 0)
|
if (r > 0)
|
||||||
write(fd, buf, r);
|
r = write(fd, buf, r);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ spawn(char *file, char *arg, char *dir)
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
if (dir != NULL)
|
if (dir != NULL)
|
||||||
chdir(dir);
|
status = chdir(dir);
|
||||||
execlp(file, file, arg, NULL);
|
execlp(file, file, arg, NULL);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -218,7 +218,6 @@ openwith(char *file)
|
||||||
DPRINTF_S(mime);
|
DPRINTF_S(mime);
|
||||||
|
|
||||||
if (strcmp(mime, "text/plain") == 0)
|
if (strcmp(mime, "text/plain") == 0)
|
||||||
magic_close(magic);
|
|
||||||
return "vim";
|
return "vim";
|
||||||
magic_close(magic);
|
magic_close(magic);
|
||||||
|
|
||||||
|
@ -566,7 +565,10 @@ redraw(char *path)
|
||||||
ncols = PATH_MAX;
|
ncols = PATH_MAX;
|
||||||
strlcpy(cwd, path, ncols);
|
strlcpy(cwd, path, ncols);
|
||||||
cwd[ncols - strlen(CWD) - 1] = '\0';
|
cwd[ncols - strlen(CWD) - 1] = '\0';
|
||||||
realpath(cwd, cwdresolved);
|
if (!realpath(cwd, cwdresolved)) {
|
||||||
|
printmsg("Cannot resolve path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
printw(CWD "%s\n\n", cwdresolved);
|
printw(CWD "%s\n\n", cwdresolved);
|
||||||
|
|
||||||
|
@ -666,10 +668,10 @@ nochange:
|
||||||
bin = openwith(newpath);
|
bin = openwith(newpath);
|
||||||
if (bin == NULL) {
|
if (bin == NULL) {
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
|
int status;
|
||||||
sprintf(cmd, "xdg-open \"%s\" > /dev/null 2>&1", newpath);
|
sprintf(cmd, "xdg-open \"%s\" > /dev/null 2>&1", newpath);
|
||||||
system(cmd);
|
status = system(cmd);
|
||||||
printmsg("No association");
|
continue;
|
||||||
goto nochange;
|
|
||||||
}
|
}
|
||||||
exitcurses();
|
exitcurses();
|
||||||
spawn(bin, newpath, NULL);
|
spawn(bin, newpath, NULL);
|
||||||
|
|
Loading…
Reference in a new issue