[PATCH:libXau 5/5] Use remove() instead of unlink() to delete lock files

Alan Coopersmith alan.coopersmith at oracle.com
Sat Mar 30 14:32:41 PDT 2013


In normal cases, no difference.  If someone has accidentally created
a directory with those names, this can save you from needing to fsck
to clean it up on some filesystems (like UFS).

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 AuLock.c   |    4 ++--
 AuUnlock.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/AuLock.c b/AuLock.c
index ce15f25..5dfc174 100644
--- a/AuLock.c
+++ b/AuLock.c
@@ -64,8 +64,8 @@ long	dead)
 	 * case a 0 deadtime to force lock removal
 	 */
 	if (dead == 0 || now - statb.st_ctime > dead) {
-	    (void) unlink (creat_name);
-	    (void) unlink (link_name);
+	    (void) remove (creat_name);
+	    (void) remove (link_name);
 	}
     }
 
diff --git a/AuUnlock.c b/AuUnlock.c
index 309ba6d..b817246 100644
--- a/AuUnlock.c
+++ b/AuUnlock.c
@@ -49,9 +49,9 @@ _Xconst char *file_name)
      * I think this is the correct order
      */
 #ifndef WIN32
-    (void) unlink (creat_name);
+    (void) remove (creat_name);
 #endif
-    (void) unlink (link_name);
+    (void) remove (link_name);
 
     return 1;
 }
-- 
1.7.9.2



More information about the xorg-devel mailing list