aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-09-15 16:12:02 +0200
committerOmar Polo <op@omarpolo.com>2021-09-15 16:12:02 +0200
commit5d7c642a6671900ac3079d2dab6a28efa810d7bb (patch)
tree4e3def737d31a2ad9b8023bba02c3523e4025b13
parent335cfaecaa61dab5171f9bdada6b5c1e934e73ac (diff)
downloadtelescope-5d7c642a6671900ac3079d2dab6a28efa810d7bb.tar.gz
telescope-5d7c642a6671900ac3079d2dab6a28efa810d7bb.tar.bz2
don't acquire the file lock in safe_mode
-rw-r--r--telescope.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/telescope.c b/telescope.c
index b9cac84..b48313b 100644
--- a/telescope.c
+++ b/telescope.c
@@ -1061,7 +1061,7 @@ main(int argc, char * const *argv)
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;
@@ -1151,7 +1151,7 @@ main(int argc, char * const *argv)
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?");
@@ -1218,7 +1218,8 @@ main(int argc, char * const *argv)
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;
}