浏览代码

getdate: correctly specify error number

POSIX defines getdate error #5 as:
"An I/O error is encountered while reading the template file."

POSIX defines getdate error #7 as:
"There is no line in the template that matches the input."

This change correctly disambiguates between the two error conditions.
A. Wilcox 7 年之前
父节点
当前提交
1080008809
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/time/getdate.c

+ 2 - 1
src/time/getdate.c

@@ -37,7 +37,8 @@ struct tm *getdate(const char *s)
 		}
 	}
 
-	getdate_err = 7;
+	if (ferror(f)) getdate_err = 5;
+	else getdate_err = 7;
 out:
 	if (f) fclose(f);
 	pthread_setcancelstate(cs, 0);