summaryrefslogtreecommitdiffstats
path: root/sbin/hastd
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-09-27 07:52:39 +0000
committerpjd <pjd@FreeBSD.org>2011-09-27 07:52:39 +0000
commitff11c3069e6db5789566bf2006ba6c8976c45e7c (patch)
treee603698b4c4242482aee27f1fd516b6d8e963bc3 /sbin/hastd
parentd35869ca7e2985d087d51a291649c60594a7436e (diff)
downloadFreeBSD-src-ff11c3069e6db5789566bf2006ba6c8976c45e7c.zip
FreeBSD-src-ff11c3069e6db5789566bf2006ba6c8976c45e7c.tar.gz
No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't
modify errno. MFC after: 3 days
Diffstat (limited to 'sbin/hastd')
-rw-r--r--sbin/hastd/proto_tcp.c7
-rw-r--r--sbin/hastd/subr.c36
2 files changed, 20 insertions, 23 deletions
diff --git a/sbin/hastd/proto_tcp.c b/sbin/hastd/proto_tcp.c
index 8f0f157..44eb13b 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 89ffda0..45218bb 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);
}
OpenPOWER on IntegriCloud