Date: Mon, 19 Oct 2009 15:01:32 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 169595 for review Message-ID: <200910191501.n9JF1WUq073023@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=169595 Change 169595 by rwatson@rwatson_vimage_client on 2009/10/19 15:01:02 Countless printf(3) format string warning fixes, most inspired by my rediscovery of amd64. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_capabilities.c#5 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_capabilities.c#5 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_capabilities.c#4 $"); +__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_capabilities.c#5 $"); #include <sys/param.h> #include <sys/capability.h> @@ -70,109 +70,109 @@ fd_capcap = cap_new(fd_cap, rights); if ((fd_capcap < 0) || (fd_capcap == fd_cap)) - err(-1, "cap_new: fd_capcap = %i, fd_cap = %i", + err(-1, "cap_new: fd_capcap = %d, fd_cap = %d", fd_capcap, fd_cap); ssize = read(fd_cap, &ch, sizeof(ch)); if ((rights & (CAP_READ | CAP_SEEK)) == (CAP_READ | CAP_SEEK)) { if (ssize < 0) - warnx("rights 0x%llx read failed error %d", rights, + warnx("rights 0x%jx read failed error %d", rights, errno); } else { if (ssize >= 0) - warnx("rights 0x%llx read succeeded", rights); + warnx("rights 0x%jx read succeeded", rights); else if (errno != ENOTCAPABLE) - warnx("rights 0x%llx read wrong error %d", rights, + warnx("rights 0x%jx read wrong error %d", rights, errno); } ssize = pread(fd_cap, &ch, sizeof(ch), 0); ssize2 = pread(fd_cap, &ch, sizeof(ch), 0); if(ssize != ssize2) - err(-1, "pread(fd_capcap) != pread(fd_cap) (%i != %i)", + err(-1, "pread(fd_capcap) != pread(fd_cap) (%zd != %zd)", ssize2, ssize); if (rights & CAP_READ) { if (ssize < 0) - warnx("rights 0x%llx pread failed error %d", rights, + warnx("rights 0x%jx pread failed error %d", rights, errno); } else { if (ssize >= 0) - warnx("rights 0x%llx pread succeeded", rights); + warnx("rights 0x%jx pread succeeded", rights); else if (errno != ENOTCAPABLE) - warnx("rights 0x%llx pread wrong error %d", rights, + warnx("rights 0x%jx pread wrong error %d", rights, errno); } ssize = write(fd_cap, &ch, sizeof(ch)); if ((rights & (CAP_WRITE | CAP_SEEK)) == (CAP_WRITE | CAP_SEEK)) { if (ssize < 0) - warnx("rights 0x%llx write failed error %d", rights, + warnx("rights 0x%jx write failed error %d", rights, errno); } else { if (ssize >= 0) - warnx("rights 0x%llx write succeeded", rights); + warnx("rights 0x%jx write succeeded", rights); else if (errno != ENOTCAPABLE) - warnx("rights 0x%llx write wrong error %d", rights, + warnx("rights 0x%jx write wrong error %d", rights, errno); } ssize = pwrite(fd_cap, &ch, sizeof(ch), 0); if (rights & CAP_WRITE) { if (ssize < 0) - warnx("rights 0x%llx pwrite failed error %d", rights, + warnx("rights 0x%jx pwrite failed error %d", rights, errno); } else { if (ssize >= 0) - warnx("rights 0x%llx pwrite succeeeded", rights); + warnx("rights 0x%jx pwrite succeeeded", rights); else if (errno != ENOTCAPABLE) - warnx("rights 0x%llx pwrite wrong error %d", rights, + warnx("rights 0x%jx pwrite wrong error %d", rights, errno); } off = lseek(fd_cap, 0, SEEK_SET); if (rights & CAP_SEEK) { if (off < 0) - warnx("rights 0x%llx lseek failed error %d", rights, + warnx("rights 0x%jx lseek failed error %d", rights, errno); } else { if (off >= 0) - warnx("rights 0x%llx lseek succeeded", rights); + warnx("rights 0x%jx lseek succeeded", rights); else if (errno != ENOTCAPABLE) - warnx("rights 0x%llx lseek wrong error %d", rights, + warnx("rights 0x%jx lseek wrong error %d", rights, errno); } ret = fchflags(fd_cap, UF_NODUMP); if (rights & CAP_FCHFLAGS) { if (ret < 0) - warnx("rights 0x%llx fchflags failed error %d", + warnx("rights 0x%jx fchflags failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fchflags succeeded", rights); + warnx("rights 0x%jx fchflags succeeded", rights); } ret = fstat(fd_cap, &sb); if (rights & CAP_FSTAT) { if (ret < 0) - warnx("rights 0x%llx fstat failed error %d", + warnx("rights 0x%jx fstat failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fstat succeeded", rights); + warnx("rights 0x%jx fstat succeeded", rights); } p = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED, fd_cap, 0); if ((rights & (CAP_MMAP | CAP_READ)) == (CAP_MMAP | CAP_READ)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap read failed error %d", + warnx("rights 0x%jx mmap read failed error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap read succeeded", rights); + warnx("rights 0x%jx mmap read succeeded", rights); (void)munmap(p, getpagesize()); } } @@ -180,13 +180,13 @@ p = mmap(NULL, getpagesize(), PROT_WRITE, MAP_SHARED, fd_cap, 0); if ((rights & (CAP_MMAP | CAP_WRITE)) == (CAP_MMAP | CAP_WRITE)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap write failed error %d", + warnx("rights 0x%jx mmap write failed error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap write succeeded", rights); + warnx("rights 0x%jx mmap write succeeded", rights); (void)munmap(p, getpagesize()); } } @@ -194,13 +194,13 @@ p = mmap(NULL, getpagesize(), PROT_EXEC, MAP_SHARED, fd_cap, 0); if ((rights & (CAP_MMAP | CAP_MAPEXEC)) == (CAP_MMAP | CAP_MAPEXEC)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap mapexec failed error %d", + warnx("rights 0x%jx mmap mapexec failed error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap mapexec succeeded", rights); + warnx("rights 0x%jx mmap mapexec succeeded", rights); (void)munmap(p, getpagesize()); } } @@ -210,13 +210,13 @@ if ((rights & (CAP_MMAP | CAP_READ | CAP_WRITE)) == (CAP_MMAP | CAP_READ | CAP_WRITE)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap read|write failed error %d", + warnx("rights 0x%jx mmap read|write failed error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap read|write succeeded", + warnx("rights 0x%jx mmap read|write succeeded", rights); (void)munmap(p, getpagesize()); } @@ -227,13 +227,13 @@ if ((rights & (CAP_MMAP | CAP_READ | CAP_MAPEXEC)) == (CAP_MMAP | CAP_READ | CAP_MAPEXEC)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap read|mapexec failed error %d", + warnx("rights 0x%jx mmap read|mapexec failed error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap read|mapexec succeeded", + warnx("rights 0x%jx mmap read|mapexec succeeded", rights); (void)munmap(p, getpagesize()); } @@ -244,13 +244,13 @@ if ((rights & (CAP_MMAP | CAP_MAPEXEC | CAP_WRITE)) == (CAP_MMAP | CAP_MAPEXEC | CAP_WRITE)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap mapexec|write failed " + warnx("rights 0x%jx mmap mapexec|write failed " "error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap mapexec|write succeeded", + warnx("rights 0x%jx mmap mapexec|write succeeded", rights); (void)munmap(p, getpagesize()); } @@ -261,13 +261,13 @@ if ((rights & (CAP_MMAP | CAP_READ | CAP_WRITE | CAP_MAPEXEC)) == (CAP_MMAP | CAP_READ | CAP_WRITE | CAP_MAPEXEC)) { if (p == MAP_FAILED) - warnx("rights 0x%llx mmap read|write|mapexec failed " + warnx("rights 0x%jx mmap read|write|mapexec failed " "error %d", rights, errno); else (void)munmap(p, getpagesize()); } else { if (p != MAP_FAILED) { - warnx("rights 0x%llx mmap read|write|mapexec " + warnx("rights 0x%jx mmap read|write|mapexec " "succeeded", rights); (void)munmap(p, getpagesize()); } @@ -280,41 +280,41 @@ ret = fsync(fd_cap); if (rights & CAP_FSYNC) { if (ret < 0) - warnx("rights 0x%llx fsync failed error %d", + warnx("rights 0x%jx fsync failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fsync succeeded", rights); + warnx("rights 0x%jx fsync succeeded", rights); } ret = fchown(fd_cap, -1, -1); if (rights & CAP_FCHOWN) { if (ret < 0) - warnx("rights 0x%llx fchown failed error %d", + warnx("rights 0x%jx fchown failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fchown succeeded", rights); + warnx("rights 0x%jx fchown succeeded", rights); } ret = fchmod(fd_cap, 0644); if (rights & CAP_FCHMOD) { if (ret < 0) - warnx("rights 0x%llx fchmod failed error %d", + warnx("rights 0x%jx fchmod failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fchmod succeeded", rights); + warnx("rights 0x%jx fchmod succeeded", rights); } ret = ftruncate(fd_cap, 0); if (rights & CAP_FTRUNCATE) { if (ret < 0) - warnx("rights 0x%llx ftruncate failed error %d", + warnx("rights 0x%jx ftruncate failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx ftruncate succeeded", rights); + warnx("rights 0x%jx ftruncate succeeded", rights); } /* XXX flock */ @@ -322,31 +322,31 @@ ret = fstatfs(fd_cap, &sf); if (rights & CAP_FSTATFS) { if (ret < 0) - warnx("rights 0x%llx fstatfs failed error %d", + warnx("rights 0x%jx fstatfs failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fstatfs succeeded", rights); + warnx("rights 0x%jx fstatfs succeeded", rights); } ret = fpathconf(fd_cap, _PC_NAME_MAX); if (rights & CAP_FPATHCONF) { if (ret < 0) - warnx("rights 0x%llx fpathconf failed error %d", + warnx("rights 0x%jx fpathconf failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx fpathconf succeeded", rights); + warnx("rights 0x%jx fpathconf succeeded", rights); } ret = futimes(fd_cap, NULL); if (rights & CAP_FUTIMES) { if (ret < 0) - warnx("rights 0x%llx futimes failed error %d", + warnx("rights 0x%jx futimes failed error %d", rights, errno); } else { if (ret == 0) - warnx("rights 0x%llx futimes succeeded", rights); + warnx("rights 0x%jx futimes succeeded", rights); } close (fd_cap);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910191501.n9JF1WUq073023>