~ubuntu-branches/ubuntu/hardy/klibc/hardy-updates

« back to all changes in this revision

Viewing changes to usr/kinit/open.c

  • Committer: Bazaar Package Importer
  • Author(s): Jeff Bailey
  • Date: 2006-01-04 20:24:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060104202452-ec4v3n829rymukuv
Tags: 1.1.15-0ubuntu1
* New upstream version.

* Patch to fix compilation on parisc64 kernels.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * open.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
}
 
19
 
 
20
    
 
21
 
 
22