代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/util-linux 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From d9fe56d8da9015694fcba5f3dd850becff677ab5 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 20 Sep 2019 13:00:19 +0200
Subject: [PATCH] libmount: use fmemopen() in more robust way [coverity scan]
Upstream: http://github.com/karelzak/util-linux/commit/026f7d302066a4e6f5a69dc9818ec3180939f4a3
Upstream: http://github.com/karelzak/util-linux/commit/bc747dfccf511419312ec872cefa90e25d83136a
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1751447
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/utils.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index f7d85d124..04e79f53f 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -1219,20 +1219,26 @@ success:
*/
FILE *mnt_get_procfs_memstream(int fd, char **membuf)
{
- FILE *memf;
size_t sz = 0;
off_t cur;
+ *membuf = NULL;
+
/* in case of error, rewind to the original position */
cur = lseek(fd, 0, SEEK_CUR);
- if (read_procfs_file(fd, membuf, &sz) == 0
- && sz > 0
- && (memf = fmemopen(*membuf, sz, "r")))
- return memf;
+ if (read_procfs_file(fd, membuf, &sz) == 0 && sz > 0) {
+ FILE *memf = fmemopen(*membuf, sz, "r");
+ if (memf)
+ return memf; /* success */
+
+ free(*membuf);
+ *membuf = NULL;
+ }
/* error */
- lseek(fd, cur, SEEK_SET);
+ if (cur != (off_t) -1)
+ lseek(fd, cur, SEEK_SET);
return NULL;
}
#else
--
2.21.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。