Skip to contentSkip to conversation

Use more appropriate error codes in create_temp_file()

PATCH New David Sommerseth 1 participant 1 message Apr 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use more appropriate error codes in create_temp_file()

From: David Sommerseth <[email protected]...>

Avoids using M_FATAL, which will terminate the OpenVPN process, except where it really is needed. It's considered needed when the function fails after 5 attempts, as that most likely indicates problem with getting enough random data for the filename.

---
 misc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
misc.c +2 -2
index 643ffad..bd918ab 100644
@@ -1190,7 +1190,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
       retfname = gen_path (directory, BSTR (&fname), gc);
       if (!retfname)
         {
-          msg (M_FATAL, "Failed to create temporary filename and path");
+          msg (M_WARN, "Failed to create temporary filename and path");
           return NULL;
         }
 
@@ -1206,7 +1206,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
         {
           /* Something else went wrong, no need to retry.  */
           struct gc_arena gcerr = gc_new ();
-          msg (M_FATAL, "Could not create temporary file '%s': %s",
+          msg (M_NONFATAL, "Could not create temporary file '%s': %s",
                retfname, strerror_ts (errno, &gcerr));
           gc_free (&gcerr);
           return NULL;
Signature · 1 line
1.6.6.1