Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Sep 2011 07:52:40 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225781 - head/sbin/hastd
Message-ID:  <201109270752.p8R7qek7011399@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Tue Sep 27 07:52:39 2011
New Revision: 225781
URL: http://svn.freebsd.org/changeset/base/225781

Log:
  No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't
  modify errno.
  
  MFC after:	3 days

Modified:
  head/sbin/hastd/proto_tcp.c
  head/sbin/hastd/subr.c

Modified: head/sbin/hastd/proto_tcp.c
==============================================================================
--- head/sbin/hastd/proto_tcp.c	Tue Sep 27 07:33:04 2011	(r225780)
+++ head/sbin/hastd/proto_tcp.c	Tue Sep 27 07:52:39 2011	(r225781)
@@ -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);
 	}
 

Modified: head/sbin/hastd/subr.c
==============================================================================
--- head/sbin/hastd/subr.c	Tue Sep 27 07:33:04 2011	(r225780)
+++ head/sbin/hastd/subr.c	Tue Sep 27 07:52:39 2011	(r225781)
@@ -87,14 +87,13 @@ provinfo(struct hast_resource *res, bool
 		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
 		 */
 		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);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109270752.p8R7qek7011399>