projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update netpacket/packet.h to linux v4.3
[musl]
/
src
/
network
/
lookup_serv.c
diff --git
a/src/network/lookup_serv.c
b/src/network/lookup_serv.c
index
4faa5bc
..
66ebaea
100644
(file)
--- a/
src/network/lookup_serv.c
+++ b/
src/network/lookup_serv.c
@@
-4,6
+4,7
@@
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
+#include <errno.h>
#include "lookup.h"
#include "stdio_impl.h"
#include "lookup.h"
#include "stdio_impl.h"
@@
-69,7
+70,14
@@
int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int pro
unsigned char _buf[1032];
FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
unsigned char _buf[1032];
FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
- if (!f) return EAI_SERVICE;
+ if (!f) switch (errno) {
+ case ENOENT:
+ case ENOTDIR:
+ case EACCES:
+ return EAI_SERVICE;
+ default:
+ return EAI_SYSTEM;
+ }
while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
if ((p=strchr(line, '#'))) *p++='\n', *p=0;
while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
if ((p=strchr(line, '#'))) *p++='\n', *p=0;