Merge tag 'upstream/3.3.2'
[debian/amanda] / server-src / amindexd.c
index bc56ed4f48cbedb83c61ce97b7ab5f95112ab6b7..91d7db69d6761e5e1747179eba869c14dc34d10f 100644 (file)
@@ -282,9 +282,16 @@ uncompress_file(
 
        /* start the sort process */
        putenv(stralloc("LC_ALL=C"));
-       pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
-                            &pipe_to_sort, &indexfd, &sort_errfd,
-                            SORT_PATH, NULL);
+       if (getconf_seen(CNF_TMPDIR)) {
+           gchar *tmpdir = getconf_str(CNF_TMPDIR);
+           pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
+                                &pipe_to_sort, &indexfd, &sort_errfd,
+                                SORT_PATH, "-T", tmpdir, NULL);
+       } else {
+           pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
+                                &pipe_to_sort, &indexfd, &sort_errfd,
+                                SORT_PATH, NULL);
+       }
        aclose(indexfd);
 
        /* start a subprocess */