svn commit: r317944 - head/usr.sbin/makefs

Ed Maste emaste at FreeBSD.org
Mon May 8 16:34:42 UTC 2017


Author: emaste
Date: Mon May  8 16:34:39 2017
New Revision: 317944
URL: https://svnweb.freebsd.org/changeset/base/317944

Log:
  makefs: cast snprintf return value to size_t to clear warning
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/makefs/ffs.c
  head/usr.sbin/makefs/walk.c

Modified: head/usr.sbin/makefs/ffs.c
==============================================================================
--- head/usr.sbin/makefs/ffs.c	Mon May  8 16:06:20 2017	(r317943)
+++ head/usr.sbin/makefs/ffs.c	Mon May  8 16:34:39 2017	(r317944)
@@ -846,8 +846,8 @@ ffs_populate_dir(const char *dir, fsnode
 	for (cur = root; cur != NULL; cur = cur->next) {
 		if (cur->child == NULL)
 			continue;
-		if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name)
-		    >= sizeof(path))
+		if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir,
+		    cur->name) >= sizeof(path))
 			errx(1, "Pathname too long.");
 		if (! ffs_populate_dir(path, cur->child, fsopts))
 			return (0);

Modified: head/usr.sbin/makefs/walk.c
==============================================================================
--- head/usr.sbin/makefs/walk.c	Mon May  8 16:06:20 2017	(r317943)
+++ head/usr.sbin/makefs/walk.c	Mon May  8 16:34:39 2017	(r317944)
@@ -84,7 +84,7 @@ walk_dir(const char *root, const char *d
 	assert(root != NULL);
 	assert(dir != NULL);
 
-	len = snprintf(path, sizeof(path), "%s/%s", root, dir);
+	len = (size_t)snprintf(path, sizeof(path), "%s/%s", root, dir);
 	if (len >= (int)sizeof(path))
 		errx(1, "Pathname too long.");
 	if (debug & DEBUG_WALK_DIR)


More information about the svn-src-all mailing list