Happy new year.
[idzebra-moved-to-github.git] / rset / rstemp.c
index 709dd99..b260c49 100644 (file)
@@ -1,8 +1,5 @@
-/* $Id: rstemp.c,v 1.69 2006-11-14 08:12:09 adam Exp $
-   Copyright (C) 1995-2006
-   Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+   Copyright (C) 1994-2011 Index Data
 
 Zebra is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -168,13 +165,18 @@ static void r_flush(RSFD rfd, int mk)
     {
 #if HAVE_MKSTEMP
         char template[1024];
+
+        *template = '\0';
+
         if (info->temp_path)
-            sprintf(template, "%s/zrsXXXXXX", info->temp_path);
-        else
-            sprintf(template, "zrsXXXXXX");
+            sprintf(template, "%s/", info->temp_path);
+        strcat(template, "zrs_");
+#if HAVE_UNISTD_H
+        sprintf(template + strlen(template), "%ld_", (long) getpid());
+#endif
+        strcat(template, "XXXXXX");
 
         info->fd = mkstemp(template);
-
         if (info->fd == -1)
         {
             yaz_log(YLOG_FATAL|YLOG_ERRNO, "rstemp: mkstemp %s", template);
@@ -336,6 +338,7 @@ static void r_pos(RSFD rfd, double  *current, double  *total)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab