Date: Mon, 8 May 2017 16:57:33 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317945 - head/usr.sbin/makefs Message-ID: <201705081657.v48GvXdI034531@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon May 8 16:57:33 2017 New Revision: 317945 URL: https://svnweb.freebsd.org/changeset/base/317945 Log: makefs: further size_t warning cleanup (missing from r317944) Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/walk.c ============================================================================== --- head/usr.sbin/makefs/walk.c Mon May 8 16:34:39 2017 (r317944) +++ head/usr.sbin/makefs/walk.c Mon May 8 16:57:33 2017 (r317945) @@ -79,13 +79,14 @@ walk_dir(const char *root, const char *d char path[MAXPATHLEN + 1]; struct stat stbuf; char *name, *rp; - int dot, len; + size_t len; + int dot; assert(root != NULL); assert(dir != NULL); - len = (size_t)snprintf(path, sizeof(path), "%s/%s", root, dir); - if (len >= (int)sizeof(path)) + len = snprintf(path, sizeof(path), "%s/%s", root, dir); + if (len >= sizeof(path)) errx(1, "Pathname too long."); if (debug & DEBUG_WALK_DIR) printf("walk_dir: %s %p\n", path, parent); @@ -119,8 +120,8 @@ walk_dir(const char *root, const char *d } if (debug & DEBUG_WALK_DIR_NODE) printf("scanning %s/%s/%s\n", root, dir, name); - if (snprintf(path + len, sizeof(path) - len, "/%s", name) >= - (int)sizeof(path) - len) + if ((size_t)snprintf(path + len, sizeof(path) - len, "/%s", + name) >= sizeof(path) - len) errx(1, "Pathname too long."); if (lstat(path, &stbuf) == -1) err(1, "Can't lstat `%s'", path); @@ -396,8 +397,8 @@ apply_specdir(const char *dir, NODE *spe if (strcmp(curnode->name, curfsnode->name) == 0) break; } - if (snprintf(path, sizeof(path), "%s/%s", - dir, curnode->name) >= sizeof(path)) + if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir, + curnode->name) >= sizeof(path)) errx(1, "Pathname too long."); if (curfsnode == NULL) { /* need new entry */ struct stat stbuf;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705081657.v48GvXdI034531>