From 19efe574cd394a769672dac951e650c14a730e77 Mon Sep 17 00:00:00 2001
From: hanzhijun <hanzhijun1@huawei.com>
Date: Wed, 6 Mar 2019 10:15:19 +0800
Subject: [PATCH] change VAR_DIR

reason: change VAR_DIR

Signed-off-by: hanzhijun <hanzhijun1@huawei.com>
---
 lib/commonio.c | 11 +++++++----
 1 file changed, 7 insertion(+), 4 deletion(-)

diff -Nur shadow-4.6.old/lib/commonio.c shadow-4.6/lib/commonio.c
--- shadow-4.6.old/lib/commonio.c	2019-03-05 06:42:27.620509161 -0500
+++ shadow-4.6/lib/commonio.c	2019-03-05 06:48:05.048509161 -0500
@@ -51,6 +51,8 @@
 #include "prototypes.h"
 #include "commonio.h"
 
+#define VAR_DIR "/var/run/"
+
 /* local function prototypes */
 static int lrename (const char *, const char *);
 static int check_link_count (const char *file);
@@ -399,9 +401,10 @@
 	if(lock == NULL) {
 		goto cleanup_ENOMEM;
 	}
-	snprintf (file, file_len, "%s.%lu",
-	          db->filename, (unsigned long) getpid ());
-	snprintf (lock, lock_file_len, "%s.lock", db->filename);
+	snprintf (file, file_len, "%s%s.%lu",
+                 VAR_DIR, basename(db->filename), (unsigned long) getpid ());
+       snprintf (lock, lock_file_len, "%s%s.lock", VAR_DIR, basename(db->filename));
+
 	if (do_lock_file (file, lock, log) != 0) {
 		db->locked = true;
 		lock_count++;
@@ -517,7 +520,7 @@
 		 * then call ulckpwdf() (if used) on last unlock.
 		 */
 		db->locked = false;
-		snprintf (lock, sizeof lock, "%s.lock", db->filename);
+		snprintf (lock, sizeof lock, "%s%s.lock", VAR_DIR, basename(db->filename));
 		unlink (lock);
 		dec_lock_count ();
 		return 1;
