Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/open_cloexec.c
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 286 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 286 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | /* |
2 | * open_cloexec.c |
3 | * |
4 | * A quick hack to do an open() and set the cloexec flag |
5 | */ |
6 | |
7 | #include <unistd.h> |
8 | #include <fcntl.h> |
9 | |
10 | int open_cloexec(const char *path, int flags, mode_t mode) |
11 | { |
12 | int fd = open(path, flags, mode); |
13 | |
14 | if (fd >= 0) |
15 | fcntl(fd, F_SETFD, FD_CLOEXEC); |
16 | |
17 | return fd; |
18 | } |