summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/debug.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/debug.c b/src/util/debug.c
index e9ed8ae1..89b6217e 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -43,11 +43,14 @@ FILE *debug_file = NULL;
errno_t set_debug_file_from_fd(const int fd)
{
FILE *dummy;
+ errno_t ret;
+ errno = 0;
dummy = fdopen(fd, "a");
if (dummy == NULL) {
- DEBUG(1, ("fdopen failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
+ ret = errno;
+ DEBUG(1, ("fdopen failed [%d][%s].\n", ret, strerror(ret)));
+ return ret;
}
debug_file = dummy;