diff src/lib/close-keep-errno.c @ 4011:323c09be5f00 HEAD

Moved dupliated close_save_errno() code to public close_keep_errno() function.
author Timo Sirainen <timo.sirainen@movial.fi>
date Tue, 14 Feb 2006 15:41:58 +0200
parents
children 65c69a53a7be
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/close-keep-errno.c	Tue Feb 14 15:41:58 2006 +0200
@@ -0,0 +1,13 @@
+/* Copyright (c) 2006 Timo Sirainen */
+
+#include "lib.h"
+#include "close-keep-errno.h"
+
+#include <unistd.h>
+
+void close_keep_errno(int fd)
+{
+	int old_errno = errno;
+	(void)close(fd);
+	errno = old_errno;
+}