From 1ebc0407fc20e6832bb446cd09b341193f69b73d Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Tue, 27 Sep 2011 07:52:39 +0000 Subject: [PATCH] No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't modify errno. MFC after: 3 days --- sbin/hastd/proto_tcp.c | 7 +++---- sbin/hastd/subr.c | 36 +++++++++++++++++------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/sbin/hastd/proto_tcp.c b/sbin/hastd/proto_tcp.c index 8f0f157cf020..44eb13ba77a6 100644 --- a/sbin/hastd/proto_tcp.c +++ b/sbin/hastd/proto_tcp.c @@ -298,8 +298,7 @@ tcp_connect(void *ctx, int timeout) flags = fcntl(tctx->tc_fd, F_GETFL); if (flags == -1) { - KEEP_ERRNO(pjdlog_common(LOG_DEBUG, 1, errno, - "fcntl(F_GETFL) failed")); + pjdlog_common(LOG_DEBUG, 1, errno, "fcntl(F_GETFL) failed"); return (errno); } /* @@ -308,8 +307,8 @@ tcp_connect(void *ctx, int timeout) */ flags |= O_NONBLOCK; if (fcntl(tctx->tc_fd, F_SETFL, flags) == -1) { - KEEP_ERRNO(pjdlog_common(LOG_DEBUG, 1, errno, - "fcntl(F_SETFL, O_NONBLOCK) failed")); + pjdlog_common(LOG_DEBUG, 1, errno, + "fcntl(F_SETFL, O_NONBLOCK) failed"); return (errno); } diff --git a/sbin/hastd/subr.c b/sbin/hastd/subr.c index 89ffda0fe2f3..45218bbdf27c 100644 --- a/sbin/hastd/subr.c +++ b/sbin/hastd/subr.c @@ -87,14 +87,13 @@ provinfo(struct hast_resource *res, bool dowrite) res->hr_localfd = open(res->hr_localpath, dowrite ? O_RDWR : O_RDONLY); if (res->hr_localfd < 0) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, "Unable to open %s", - res->hr_localpath)); + pjdlog_errno(LOG_ERR, "Unable to open %s", + res->hr_localpath); return (-1); } } if (fstat(res->hr_localfd, &sb) < 0) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, "Unable to stat %s", - res->hr_localpath)); + pjdlog_errno(LOG_ERR, "Unable to stat %s", res->hr_localpath); return (-1); } if (S_ISCHR(sb.st_mode)) { @@ -103,16 +102,16 @@ provinfo(struct hast_resource *res, bool dowrite) */ if (ioctl(res->hr_localfd, DIOCGMEDIASIZE, &res->hr_local_mediasize) < 0) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, + pjdlog_errno(LOG_ERR, "Unable obtain provider %s mediasize", - res->hr_localpath)); + res->hr_localpath); return (-1); } if (ioctl(res->hr_localfd, DIOCGSECTORSIZE, &res->hr_local_sectorsize) < 0) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, + pjdlog_errno(LOG_ERR, "Unable obtain provider %s sectorsize", - res->hr_localpath)); + res->hr_localpath); return (-1); } } else if (S_ISREG(sb.st_mode)) { @@ -169,8 +168,8 @@ drop_privs(struct hast_resource *res) pw = getpwnam(HAST_USER); if (pw == NULL) { if (errno != 0) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, - "Unable to find info about '%s' user", HAST_USER)); + pjdlog_errno(LOG_ERR, + "Unable to find info about '%s' user", HAST_USER); return (-1); } else { pjdlog_error("'%s' user doesn't exist.", HAST_USER); @@ -201,28 +200,27 @@ drop_privs(struct hast_resource *res) pjdlog_errno(LOG_WARNING, "Unable to jail to directory to %s", pw->pw_dir); if (chroot(pw->pw_dir) == -1) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, + pjdlog_errno(LOG_ERR, "Unable to change root directory to %s", - pw->pw_dir)); + pw->pw_dir); return (-1); } } PJDLOG_VERIFY(chdir("/") == 0); gidset[0] = pw->pw_gid; if (setgroups(1, gidset) == -1) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, - "Unable to set groups to gid %u", - (unsigned int)pw->pw_gid)); + pjdlog_errno(LOG_ERR, "Unable to set groups to gid %u", + (unsigned int)pw->pw_gid); return (-1); } if (setgid(pw->pw_gid) == -1) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, "Unable to set gid to %u", - (unsigned int)pw->pw_gid)); + pjdlog_errno(LOG_ERR, "Unable to set gid to %u", + (unsigned int)pw->pw_gid); return (-1); } if (setuid(pw->pw_uid) == -1) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, "Unable to set uid to %u", - (unsigned int)pw->pw_uid)); + pjdlog_errno(LOG_ERR, "Unable to set uid to %u", + (unsigned int)pw->pw_uid); return (-1); }