retain 'errno' on the final unlink()
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 6 Oct 2004 03:19:45 +0000 (03:19 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 6 Oct 2004 03:19:45 +0000 (03:19 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1724 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/lib_internal/unify-unify.c

index 8c69cce..2cf41f9 100644 (file)
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <errno.h>
 #include <sys/stat.h>
 
 bool
@@ -88,8 +89,11 @@ Unify_unify(char const *src, struct stat const UNUSED *src_stat,
   res = true;
 
   err:
-  if (tmpfile[0]!='\0')
+  if (tmpfile[0]!='\0') {
+    int        old_errno = errno;
     unlink(tmpfile);
+    errno = old_errno;
+  }
 
   return res;
 }