diff options
author | Uladox <uladoxiental@gmail.com> | 2016-08-14 22:38:28 -1000 |
---|---|---|
committer | Uladox <uladoxiental@gmail.com> | 2016-08-14 22:38:28 -1000 |
commit | 04a18e8914a1f1c2d5e43bcaeb2fd44b37b9cfe6 (patch) | |
tree | a76d31892a6c7a8f1179eecf5b0d01c34349a1e3 /jackd | |
parent | 8a7253575c58134bb33b2b24f10eec7ce7bd051d (diff) | |
download | jack1-04a18e8914a1f1c2d5e43bcaeb2fd44b37b9cfe6.tar.gz |
Removes use of gloabl jack_tmpdir.
Uses static local variable like how jack_user_dir does. jack_get_tmpdir()
replaces jack_tmpdir for the most part except in jackd -l where it would
cause an infinite loop, and instead DEFAULT_TMP_DIR is used, which is
what it would happen anyway. Also in jack_user_dir the default value is
used if jack_user_dir returns NULL from some error, but an error message
is printed with jack_error(), this is the same as the old behavior, but
I am not sure this is quite what should happen. Still, the exact same
behavior as before is acheived except without the use of the jack_tmpdir
global and the memory issues caused by calling jack_get_tmpdir().
Diffstat (limited to 'jackd')
-rw-r--r-- | jackd/engine.c | 12 | ||||
-rw-r--r-- | jackd/jackd.c | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/jackd/engine.c b/jackd/engine.c index c6b2e60..365a29a 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -227,16 +227,22 @@ make_socket_subdirectories (const char *server_name) { struct stat statbuf; char server_dir[PATH_MAX + 1] = ""; + const char *tmpdir = jack_get_tmpdir (); + + if (tmpdir == NULL) { + jack_error ("Unable to get tmpdir in engine"); + return -1; + } /* check tmpdir directory */ - if (stat (jack_tmpdir, &statbuf)) { + if (stat (tmpdir, &statbuf)) { jack_error ("cannot stat() %s (%s)\n", - jack_tmpdir, strerror (errno)); + tmpdir, strerror (errno)); return -1; } else { if (!S_ISDIR (statbuf.st_mode)) { jack_error ("%s exists, but is not a directory!\n", - jack_tmpdir); + tmpdir); return -1; } } diff --git a/jackd/jackd.c b/jackd/jackd.c index 0faae93..90fb38f 100644 --- a/jackd/jackd.c +++ b/jackd/jackd.c @@ -812,7 +812,8 @@ main (int argc, char *argv[]) case 'l': /* special flag to allow libjack to determine jackd's idea of where tmpdir is */ - printf ("%s\n", jack_tmpdir); + printf("%s\n", DEFAULT_TMP_DIR); + exit (0); case 'I': |