47 lines
1.0 KiB
Diff
47 lines
1.0 KiB
Diff
|
|
From 0f3d89015caf91ea96359ba7e2afd2aa8ab67e85 Mon Sep 17 00:00:00 2001
|
||
|
|
From: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||
|
|
Date: Fri, 25 Jan 2019 17:03:05 +0000
|
||
|
|
Subject: [PATCH] ok
|
||
|
|
|
||
|
|
Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||
|
|
---
|
||
|
|
tools/depmod.c | 7 ++++---
|
||
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/tools/depmod.c b/tools/depmod.c
|
||
|
|
index 989d907..f519679 100644
|
||
|
|
--- a/tools/depmod.c
|
||
|
|
+++ b/tools/depmod.c
|
||
|
|
@@ -2438,7 +2438,7 @@ static int depmod_output(struct depmod *depmod, FILE *out)
|
||
|
|
r = itr->cb(depmod, fp);
|
||
|
|
if (fp == out)
|
||
|
|
continue;
|
||
|
|
-
|
||
|
|
+ fsync(fileno(fp));
|
||
|
|
ferr = ferror(fp) | fclose(fp);
|
||
|
|
|
||
|
|
if (r < 0) {
|
||
|
|
@@ -2451,7 +2451,6 @@ static int depmod_output(struct depmod *depmod, FILE *out)
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
- unlinkat(dfd, itr->name, 0);
|
||
|
|
if (renameat(dfd, tmp, dfd, itr->name) != 0) {
|
||
|
|
err = -errno;
|
||
|
|
CRIT("renameat(%s, %s, %s, %s): %m\n",
|
||
|
|
@@ -2467,8 +2466,10 @@ static int depmod_output(struct depmod *depmod, FILE *out)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (dfd >= 0)
|
||
|
|
+ if (dfd >= 0) {
|
||
|
|
+ fsync(dfd);
|
||
|
|
close(dfd);
|
||
|
|
+ }
|
||
|
|
|
||
|
|
return err;
|
||
|
|
}
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|