summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-12 17:58:07 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-15 09:18:19 -0400
commit711c9015c3845eb7ff733ea34829c4ecf32d8ab5 (patch)
tree5f9f8b9b16289772379101d80f28e8fba517d175
parent9091fdea936f7d21584682b7f3d58f49b1e7b013 (diff)
downloadsssd-711c9015c3845eb7ff733ea34829c4ecf32d8ab5.tar.gz
sssd-711c9015c3845eb7ff733ea34829c4ecf32d8ab5.tar.bz2
sssd-711c9015c3845eb7ff733ea34829c4ecf32d8ab5.zip
Handle errno properly in set_debug_file_from_fd()
-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;