commit - 335cfaecaa61dab5171f9bdada6b5c1e934e73ac
commit + 5d7c642a6671900ac3079d2dab6a28efa810d7bb
blob - b9cac84fe6d595fbaccb3e39a957c810966c6916
blob + b48313bc2d85abf9bb7a36b911d842822aaef9f5
--- telescope.c
+++ telescope.c
int ch, configtest = 0, fail = 0;
int has_url = 0;
int proc = -1;
- int sessionfd;
+ int sessionfd = -1;
int status;
char path[PATH_MAX], url[GEMINI_URL_LEN+1];
const char *argv0;
errx(1, "strdup");
fs_init();
- if ((sessionfd = lock_session()) == -1)
+ if (!safe_mode && (sessionfd = lock_session()) == -1)
errx(1, "can't lock session, is another instance of "
"telescope already running?");
warnx("child terminated; signal %d", WTERMSIG(status));
} while (pid != -1 || (pid == -1 && errno == EINTR));
- close(sessionfd);
+ if (!safe_mode && close(sessionfd) == -1)
+ err(1, "close(sessionfd = %d)", sessionfd);
return 0;
}