blob: 27dda9c38092c74c51ad1060d765a27cb18bf822 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* sb_open.c
*
* IO functions.
*
* Copyright 1999-2008 Gentoo Foundation
* Licensed under the GPL-2
*/
#include "headers.h"
#include "sbutil.h"
/* General purpose function to _reliably_ open a file
*
* Returns the file descriptor or -1 on error (and errno set)
*/
int sb_open(const char *path, int flags, mode_t mode)
{
int fd;
do {
fd = sbio_open(path, flags, mode);
} while ((-1 == fd) && (EINTR == errno));
if ((-1 != fd) && (0 != errno))
/* Do not trigger debugging */
errno = 0;
if (-1 == fd)
DBG_MSG("Failed to open file '%s'!\n", path);
return fd;
}
|