File: Fcontrol.cpp

package info (click to toggle)
ntcard 1.2.2%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,120 kB
  • sloc: cpp: 2,020; makefile: 87; sh: 70
file content (12 lines) | stat: -rw-r--r-- 275 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
#include "Fcontrol.h"
#include <fcntl.h>

/* Set the FD_CLOEXEC flag of the specified file descriptor. */
int setCloexec(int fd)
{
    int flags = fcntl(fd, F_GETFD, 0);
    if (flags == -1)
        return -1;
    flags |= FD_CLOEXEC;
    return fcntl(fd, F_SETFD, flags);
}