代码拉取完成,页面将自动刷新
From d59e4d224b3271cf7a7fe53cd7c5d539b58eac32 Mon Sep 17 00:00:00 2001
From: lvying <[email protected]>
Date: Sat, 26 Jan 2019 15:54:17 +0800
Subject: [PATCH] rasdaemon:fix rasdaemon wait for file access
reason:fix fix rasdaemon wait for file access
--- rasdaemon-0.4.1/ras-events.c 2018-04-08 04:05:18.755000000 -0400
+++ rasdaemon-0.4.1/ras-events.c 2018-04-08 04:05:46.879000000 -0400
@@ -89,15 +89,39 @@
return ENOENT;
}
+static int wait_access(char *path, int ms)
+{
+ int i;
+ for (i = 0; i < ms; i++) {
+ if (access(path, F_OK) == 0)
+ return 0;
+ usleep(1000);
+ }
+
+ log(ALL, LOG_WARNING, "wait_access() failed, %s not created in %d ms\n", path, ms);
+ return -1;
+}
+
static int open_trace(struct ras_events *ras, char *name, int flags)
{
+ int ret = 0;
char fname[MAX_PATH + 1];
strcpy(fname, ras->tracing);
strcat(fname, "/");
strcat(fname, name);
- return open(fname, flags);
+ ret = wait_access(fname, 100);
+ if (ret != 0) {
+ /* use -1 to keep same error value with open() */
+ return -1;
+ }
+
+ ret = open(fname, flags);
+ if (ret == -1)
+ log(ALL, LOG_WARNING, "open_trace()->open() failed, fname=%s ret=%d errno=%d\n", fname, ret, errno);
+
+ return ret;
}
static int get_tracing_dir(struct ras_events *ras)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。