浏览代码

check stat("/etc/resolv.conf") for errors

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko 15 年之前
父节点
当前提交
69d23570f0
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      libc/inet/resolv.c

+ 2 - 1
libc/inet/resolv.c

@@ -959,7 +959,8 @@ void attribute_hidden __open_nameservers(void)
 	if (!__res_sync) {
 		/* Reread /etc/resolv.conf if it was modified.  */
 		struct stat sb;
-		stat("/etc/resolv.conf", &sb);
+		if (stat("/etc/resolv.conf", &sb) != 0)
+			sb.st_mtime = 0;
 		if (resolv_conf_mtime != (uint32_t)sb.st_mtime) {
 			resolv_conf_mtime = sb.st_mtime;
 			__close_nameservers(); /* force config reread */