提交 7d663884 编写于 作者: H haozi007 提交者: lifeng68

improve readline util

Signed-off-by: Nhaozi007 <liuhao27@huawei.com>
上级 5594796e
...@@ -1466,15 +1466,16 @@ int isula_utils_read_line(FILE *fp, read_line_callback_t cb, void *context) ...@@ -1466,15 +1466,16 @@ int isula_utils_read_line(FILE *fp, read_line_callback_t cb, void *context)
nret = getline(&line, &len, fp); nret = getline(&line, &len, fp);
if (nret == -1) { if (nret == -1) {
// end of file // end of file
ret = (errno == 0 ? 0 : -1); if (errno != 0) {
if (ret != 0) { ret = -1;
ERROR("error read line from tar split: %s", strerror(errno)); ERROR("read line failed: %s", strerror(errno));
} }
goto out; goto out;
} }
util_trim_newline(line); util_trim_newline(line);
if (!cb(line, context)) { if (!cb(line, context)) {
ret = -1;
goto out; goto out;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册