Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jul 2018 08:43:08 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336867 - head/sbin/devd
Message-ID:  <201807290843.w6T8h8jY010712@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Sun Jul 29 08:43:08 2018
New Revision: 336867
URL: https://svnweb.freebsd.org/changeset/base/336867

Log:
  devd: use C++ style casts

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==============================================================================
--- head/sbin/devd/devd.cc	Sun Jul 29 08:43:05 2018	(r336866)
+++ head/sbin/devd/devd.cc	Sun Jul 29 08:43:08 2018	(r336867)
@@ -262,12 +262,12 @@ my_system(const char *command)
 		 */
 		cfg.close_pidfile();
 		::closefrom(3);
-		::execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
+		::execl(_PATH_BSHELL, "sh", "-c", command, nullptr);
 		::_exit(127);
 	default:			/* parent */
 		savedpid = pid;
 		do {
-			pid = ::wait4(savedpid, &pstat, 0, (struct rusage *)0);
+			pid = ::wait4(savedpid, &pstat, 0, nullptr);
 		} while (pid == -1 && errno == EINTR);
 		break;
 	}
@@ -374,7 +374,7 @@ media::do_match(config &c)
 		memset(&ifmr, 0, sizeof(ifmr));
 		strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
 
-		if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0 &&
+		if (ioctl(s, SIOCGIFMEDIA, &ifmr) >= 0 &&
 		    ifmr.ifm_status & IFM_AVALID) {
 			devdlog(LOG_DEBUG, "%s has media type 0x%x\n",
 				    value.c_str(), IFM_TYPE(ifmr.ifm_active));
@@ -527,7 +527,7 @@ config::open_pidfile()
 	pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid);
 	if (pfh == NULL) {
 		if (errno == EEXIST)
-			errx(1, "devd already running, pid: %d", (int)otherpid);
+			errx(1, "devd already running, pid: %d", static_cast<int>(otherpid));
 		warn("cannot open pid file");
 	}
 }
@@ -854,7 +854,7 @@ process_event(char *buffer)
 	// Save the time this happened (as approximated by when we got
 	// around to processing it).
 	gettimeofday(&tv, NULL);
-	asprintf(&timestr, "%jd.%06ld", (uintmax_t)tv.tv_sec, tv.tv_usec);
+	asprintf(&timestr, "%jd.%06ld", static_cast<uintmax_t>(tv.tv_sec), tv.tv_usec);
 	cfg.set_variable("timestamp", timestr);
 	free(timestr);
 
@@ -919,7 +919,7 @@ create_socket(const char *name, int socktype)
 	unlink(name);
 	if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
 	    	err(1, "fcntl");
-	if (::bind(fd, (struct sockaddr *) & sun, slen) < 0)
+	if (::bind(fd, reinterpret_cast<struct sockaddr *>(&sun), slen) < 0)
 		err(1, "bind");
 	listen(fd, 4);
 	if (chown(name, 0, 0))	/* XXX - root.wheel */



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