diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-11-09 19:33:13 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-11-09 19:33:13 +0000 |
commit | 699407b316e8a9b49370fe65941f257665b2c83e (patch) | |
tree | 538e2a283f4b07609c67fe5d488e14286491c14b /Foundation/GTMServiceManagement.c | |
parent | 144526b58bb1d6866f8c427a63036c31f8e1d8a9 (diff) |
[Author: dmaclach]
Clean up GTMServiceManagement when compiling 64 bit.
R=thomasvl
DELTA=5 (1 added, 0 deleted, 4 changed)
Diffstat (limited to 'Foundation/GTMServiceManagement.c')
-rw-r--r-- | Foundation/GTMServiceManagement.c | 9 |
1 files changed, 5 insertions, 4 deletions
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(); } |