commit 25a4c8c5c72961fdab5de9fc38472e6fca849a4a
parent b3d202e72bacd84e7a7ae53621c33fbaa983e8aa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 25 Apr 2014 23:03:53 +0200
creat() return on failure
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sdhcp.c b/sdhcp.c
@@ -192,8 +192,10 @@ setdns(unsigned char dns[4])
char buf[128];
int fd;
- if((fd = creat("/etc/resolv.conf", 0644)) == -1)
+ if((fd = creat("/etc/resolv.conf", 0644)) == -1) {
weprintf("can't change /etc/resolv.conf:");
+ return;
+ }
cat(fd, "/etc/resolv.conf.head");
if(snprintf(buf, sizeof(buf) - 1, "\nnameserver %d.%d.%d.%d\n",
dns[0], dns[1], dns[2], dns[3]) > 0)