mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
fixes 2
This commit is contained in:
1 parent
42a47d656c
commit
c2a452d3b1
1 file changed
+5
-3
@@ -22,6 +22,8 @@ extern char **environ;
|
||||
char* pongo_path = NULL;
|
||||
char* ext_checkra1n = NULL;
|
||||
|
||||
#define tmpdir getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")
|
||||
|
||||
int exec_checkra1n() {
|
||||
LOG(LOG_INFO, "About to execute checkra1n");
|
||||
int fd, ret;
|
||||
@@ -30,8 +32,8 @@ int exec_checkra1n() {
|
||||
checkra1n_path = ext_checkra1n;
|
||||
goto checkra1n_exec;
|
||||
}
|
||||
checkra1n_path = malloc(strlen(getenv("TMPDIR")) + 20);
|
||||
snprintf(checkra1n_path, strlen(getenv("TMPDIR")) + 20, "%s/checkra1n.XXXXXX", getenv("TMPDIR") != NULL ? getenv("TMPDIR") : "/tmp");
|
||||
checkra1n_path = malloc(strlen(tmpdir) + 20);
|
||||
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
||||
fd = mkstemp(checkra1n_path);
|
||||
if (fd == -1) {
|
||||
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
||||
@@ -74,7 +76,7 @@ checkra1n_exec: {};
|
||||
LOG(LOG_VERBOSE2, "%s spawned successfully", checkra1n_path);
|
||||
sleep(2);
|
||||
if (ext_checkra1n != NULL) unlink(checkra1n_path);
|
||||
if (getenv("TMPDIR") && ext_checkra1n == NULL) {
|
||||
if (ext_checkra1n == NULL) {
|
||||
free(checkra1n_path);
|
||||
checkra1n_path = NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user