Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Unified Diff: sandbox/linux/suid/sandbox.c

Issue 597023: linux: turn on -Wextra (Closed)
Patch Set: more Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/suid/process_util_linux.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/suid/sandbox.c
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c
index e4968c9e022cb42a10d35d3bdee0e24106b0e823..7389f03757bb394910b0b29e6f635d969b8f0dd2 100644
--- a/sandbox/linux/suid/sandbox.c
+++ b/sandbox/linux/suid/sandbox.c
@@ -90,13 +90,13 @@ static int CloneChrootHelperProcess() {
char tempDirectoryTemplate[80] = "/tmp/chrome-sandbox-chroot-XXXXXX";
struct statfs sfs;
if (!statfs("/tmp", &sfs) &&
- sfs.f_type != BTRFS_SUPER_MAGIC &&
- sfs.f_type != EXT2_SUPER_MAGIC &&
- sfs.f_type != EXT3_SUPER_MAGIC &&
- sfs.f_type != EXT4_SUPER_MAGIC &&
- sfs.f_type != REISERFS_SUPER_MAGIC &&
- sfs.f_type != TMPFS_MAGIC &&
- sfs.f_type != XFS_SUPER_MAGIC) {
+ (unsigned long)sfs.f_type != BTRFS_SUPER_MAGIC &&
+ (unsigned long)sfs.f_type != EXT2_SUPER_MAGIC &&
+ (unsigned long)sfs.f_type != EXT3_SUPER_MAGIC &&
+ (unsigned long)sfs.f_type != EXT4_SUPER_MAGIC &&
+ (unsigned long)sfs.f_type != REISERFS_SUPER_MAGIC &&
+ (unsigned long)sfs.f_type != TMPFS_MAGIC &&
+ (unsigned long)sfs.f_type != XFS_SUPER_MAGIC) {
// If /dev/shm exists, it is supposed to be a tmpfs filesystem. While we
// are not actually using it for shared memory, moving our temp directory
// into a known tmpfs filesystem is preferable over using a potentially
@@ -137,7 +137,7 @@ static int CloneChrootHelperProcess() {
char proc_self_fd_str[128];
int printed = snprintf(proc_self_fd_str, sizeof(proc_self_fd_str),
"/proc/self/fd/%d", chroot_dir_fd);
- if (printed < 0 || printed >= sizeof(proc_self_fd_str)) {
+ if (printed < 0 || printed >= (int)sizeof(proc_self_fd_str)) {
fprintf(stderr, "Error in snprintf");
return -1;
}
@@ -246,7 +246,7 @@ static bool SpawnChrootHelper() {
// number of the file descriptor.
char desc_str[64];
int printed = snprintf(desc_str, sizeof(desc_str), "%d", chroot_signal_fd);
- if (printed < 0 || printed >= sizeof(desc_str)) {
+ if (printed < 0 || printed >= (int)sizeof(desc_str)) {
fprintf(stderr, "Failed to snprintf\n");
return false;
}
@@ -379,9 +379,10 @@ int main(int argc, char **argv) {
if (argc == 4 && (0 == strcmp(argv[1], kAdjustOOMScoreSwitch))) {
char* endptr;
long score;
- pid_t pid = strtoul(argv[2], &endptr, 10);
- if (pid == ULONG_MAX || *endptr)
+ unsigned long pid_ul = strtoul(argv[2], &endptr, 10);
+ if (pid_ul == ULONG_MAX || *endptr)
return 1;
+ pid_t pid = pid_ul;
score = strtol(argv[3], &endptr, 10);
if (score == LONG_MAX || score == LONG_MIN || *endptr)
return 1;
« no previous file with comments | « sandbox/linux/suid/process_util_linux.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698