Uninitialized vector entry?
[minix3.git] / lib / ip / domainname.c
blobcae29d7789d1d2c74b033f0a3b795d6d07e26ce5
1 /*
2 domainname.c
3 */
5 #include <stdio.h>
6 #include <string.h>
7 #include <unistd.h>
8 #include <net/netlib.h>
10 int getdomainname(domain, size)
11 char *domain;
12 size_t size;
14 FILE *domainfile;
15 char *line;
17 domainfile= fopen("/etc/domainname", "r");
18 if (!domainfile)
20 return -1;
23 line= fgets(domain, size, domainfile);
24 fclose(domainfile);
25 if (!line)
26 return -1;
27 line= strchr(domain, '\n');
28 if (line)
29 *line= '\0';
30 return 0;