From 699407b316e8a9b49370fe65941f257665b2c83e Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Tue, 9 Nov 2010 19:33:13 +0000 Subject: [Author: dmaclach] Clean up GTMServiceManagement when compiling 64 bit. R=thomasvl DELTA=5 (1 added, 0 deleted, 4 changed) --- Foundation/GTMServiceManagement.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Foundation/GTMServiceManagement.c') diff --git a/Foundation/GTMServiceManagement.c b/Foundation/GTMServiceManagement.c index 20fb6cc..eddde4a 100644 --- a/Foundation/GTMServiceManagement.c +++ b/Foundation/GTMServiceManagement.c @@ -435,16 +435,17 @@ static int open_devnull(int fd) { void spc_sanitize_files(void) { int standard_fds[] = { STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO }; - int standard_fds_count = sizeof(standard_fds) / sizeof(standard_fds[0]); + size_t standard_fds_count = sizeof(standard_fds) / sizeof(standard_fds[0]); // Make sure all open descriptors other than the standard ones are closed - int fds = getdtablesize(); - for (int fd = standard_fds_count; fd < fds; fd++) close(fd); + size_t fds = getdtablesize(); + for (size_t i = standard_fds_count; i < fds; ++i) close(standard_fds[i]); // Verify that the standard descriptors are open. If they're not, attempt to // open them using /dev/null. If any are unsuccessful, abort. - for (int fd = 0; fd < standard_fds_count; fd++) { + for (size_t i = 0; i < standard_fds_count; ++i) { struct stat st; + int fd = standard_fds[i]; if (fstat(fd, &st) == -1 && (errno != EBADF || !open_devnull(fd))) { abort(); } -- cgit v1.2.3