From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Vlasov Date: Tue, 23 Jan 2007 15:37:33 +0000 Subject: [PATCH] unlink old database file before creating a new one Message-Id: <11695666531692-git-send-email-vsu@altlinux.ru> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org 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 --- 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; =20 + unlink(filename); f =3D fopen(filename, "w"); if (f =3D NULL) { err("unable to create db file '%s': %s", filename, strerror(errno)); --=20 1.5.0.rc2.gd894fb ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel