Commit | Line | Data |
---|---|---|
dc0d77d7 CE |
1 | #include "error.h" |
2 | #include "open.h" | |
3 | #include "readclose.h" | |
4 | #include "openreadclose.h" | |
5 | ||
6 | int openreadclose(const char *fn,stralloc *sa,unsigned int bufsize) | |
7 | { | |
8 | int fd; | |
9 | fd = open_read(fn); | |
10 | if (fd == -1) { | |
11 | if (errno == error_noent) return 0; | |
12 | return -1; | |
13 | } | |
14 | if (readclose(fd,sa,bufsize) == -1) return -1; | |
15 | return 1; | |
16 | } |