File: fopen.c

package info (click to toggle)
dietlibc 0.34~cvs20160606-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,336 kB
  • sloc: ansic: 71,631; asm: 13,006; cpp: 1,860; makefile: 799; sh: 292; perl: 62
file content (20 lines) | stat: -rw-r--r-- 520 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <sys/types.h>
#include <dietstdio.h>
#include <unistd.h>

extern int __stdio_atexit;

/* this is needed so the libpthread wrapper can initialize the mutex,
 * not to lock it */

FILE *fopen_unlocked(const char *path, const char *mode) {
  int f=0;	/* O_RDONLY, O_WRONLY or O_RDWR */
  int fd;

  f=__stdio_parse_mode(mode);
  if ((fd=__libc_open(path,f,0666))<0)
    return 0;
  return __stdio_init_file(fd,1,f);
}

FILE *fopen(const char *path, const char *mode) __attribute__((weak,alias("fopen_unlocked")));