chiark / gitweb /
fixes
[inn-innduct.git] / lib / xfopena.c
1 /*  $Id: xfopena.c 5381 2002-03-31 22:35:47Z rra $
2 **
3 */
4
5 #include "config.h"
6 #include "clibrary.h"
7 #include <fcntl.h>
8
9 #include "libinn.h"
10
11 /*
12 **  Open a file in append mode.  Since not all fopen's set the O_APPEND
13 **  flag, we do it by hand.
14 */
15 FILE *xfopena(const char *p)
16 {
17     int         fd;
18
19     /* We can't trust stdio to really use O_APPEND, so open, then fdopen. */
20     fd = open(p, O_WRONLY | O_APPEND | O_CREAT, 0666);
21     return fd >= 0 ? fdopen(fd, "a") : NULL;
22 }