diff options
| author | Roy Marples <roy@marples.name> | 2008-05-15 16:09:42 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-05-15 16:09:42 +0000 |
| commit | 8dc6afb7e808c5e24a69fd035914a1a67432a950 (patch) | |
| tree | d2474e4bfb72febc51e88e9c42cc68acb7a2d90f /common.c | |
| parent | fca9d5445b39e6efa37de6cf86c99229dfab3167 (diff) | |
| download | dhcpcd-8dc6afb7e808c5e24a69fd035914a1a67432a950.tar.xz | |
Check correct lengths and use closefrom where available.
Diffstat (limited to 'common.c')
| -rw-r--r-- | common.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -109,6 +109,20 @@ strlcpy(char *dst, const char *src, size_t size) } #endif +#ifndef HAVE_CLOSEFROM +int +closefrom(int fd) +{ + int max = getdtablesize(); + int i; + int r = 0; + + for (i = fd; i < max; i++) + r += close(i); + return r; +} +#endif + /* Close our fd's */ int close_fds(void) |
