Merge branch release-5-0
[alexxy/gromacs.git] / src / gromacs / utility / futil.cpp
index 535c7e93f1ef816f44b2882b1efa2c7d0bfa2771..55285b292be7a7478f34024929a35b9de2da0697 100644 (file)
@@ -587,19 +587,10 @@ void gmx_tmpnam(char *buf)
 #else
     int fd = mkstemp(buf);
 
-    switch (fd)
-    {
-        case EINVAL:
-            gmx_fatal(FARGS, "Invalid template %s for mkstemp", buf);
-            break;
-        case EEXIST:
-            gmx_fatal(FARGS, "mkstemp created existing file", buf);
-            break;
-        case EACCES:
-            gmx_fatal(FARGS, "Permission denied for opening %s", buf);
-            break;
-        default:
-            break;
+    if (fd < 0)
+    {
+        gmx_fatal(FARGS, "Creating temporary file %s: %s", buf,
+                  strerror(errno));
     }
     close(fd);
 #endif