From f7fa22da5d865221f84371d6b522444e1591164c Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 24 Sep 2010 09:54:45 +0200 Subject: Suppress some 'may be used uninitialized' warnings Additionally the handling of errno and the errno_t return value of functions is fixed in krb5_common.c. --- src/providers/krb5/krb5_common.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/providers/krb5/krb5_common.c') diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index e5471e3f1..d41fdb9df 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -172,8 +172,8 @@ errno_t write_krb5info_file(const char *realm, const char *server, fd = mkstemp(tmp_name); if (fd == -1) { - DEBUG(1, ("mkstemp failed [%d][%s].\n", errno, strerror(errno))); ret = errno; + DEBUG(1, ("mkstemp failed [%d][%s].\n", ret, strerror(ret))); goto done; } @@ -184,7 +184,8 @@ errno_t write_krb5info_file(const char *realm, const char *server, if (errno == EINTR || errno == EAGAIN) { continue; } - DEBUG(1, ("write failed [%d][%s].\n", errno, strerror(errno))); + ret = errno; + DEBUG(1, ("write failed [%d][%s].\n", ret, strerror(ret))); goto done; } else { @@ -195,24 +196,28 @@ errno_t write_krb5info_file(const char *realm, const char *server, if (written != server_len) { DEBUG(1, ("Write error, wrote [%d] bytes, expected [%d]\n", written, server_len)); + ret = EIO; goto done; } ret = fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (ret == -1) { - DEBUG(1, ("fchmod failed [%d][%s].\n", errno, strerror(errno))); + ret = errno; + DEBUG(1, ("fchmod failed [%d][%s].\n", ret, strerror(ret))); goto done; } ret = close(fd); if (ret == -1) { - DEBUG(1, ("close failed [%d][%s].\n", errno, strerror(errno))); + ret = errno; + DEBUG(1, ("close failed [%d][%s].\n", ret, strerror(ret))); goto done; } ret = rename(tmp_name, krb5info_name); if (ret == -1) { - DEBUG(1, ("rename failed [%d][%s].\n", errno, strerror(errno))); + ret = errno; + DEBUG(1, ("rename failed [%d][%s].\n", ret, strerror(ret))); goto done; } @@ -249,7 +254,8 @@ static void krb5_resolve_callback(void *private_data, struct fo_server *server) if (inet_ntop(srvaddr->h_addrtype, srvaddr->h_addr_list[0], address, 128) == NULL) { - DEBUG(1, ("inet_ntop failed [%d][%s].\n", errno, strerror(errno))); + ret = errno; + DEBUG(1, ("inet_ntop failed [%d][%s].\n", ret, strerror(ret))); return; } -- cgit