blob: 8bb629af1d34e724ca2bbd51d0c506ca8e66c198 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
unlink old database file before creating a new one
udev_db_add_device() can be called when the corressponding database
entry already exists - it should overwrite the old entry in this case.
However, if the old entry was a symlink, fopen(filename, "w") will not
overwrite it properly - it will keep the symlink and create a file
named after the symlink target. Calling unlink(filename) before
trying to create the database file fixes the problem.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---
commit e0c0807ab32fde7f55776e0a300016bad922e636
tree 117c38653de162d7f6e31a5b75333d1c6a21442e
parent 27283c2fdaefd9c7fd557fd4663566eacccca33a
author Sergey Vlasov <vsu@altlinux.ru> Di, 23 Jan 2007 19:55:38 +0100
committer Kay Sievers <kay.sievers@vrfy.org> Di, 23 Jan 2007 19:55:38 +0100
udev_db.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/udev_db.c b/udev_db.c
index f3c9509..b1217d8 100644
--- a/udev_db.c
+++ b/udev_db.c
@@ -93,6 +93,7 @@ int udev_db_add_device(struct udevice *udev)
struct name_entry *name_loop;
FILE *f;
+ unlink(filename);
f = fopen(filename, "w");
if (f == NULL) {
err("unable to create db file '%s': %s", filename, strerror(errno));
|