1 Star 0 Fork 37

bluesky/shadow

forked from src-openEuler/shadow 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
shadow-4.1.5.1-var-lock.patch 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-25 17:13 +08:00 . Package init
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;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/blueskycs2c/shadow.git
git@gitee.com:blueskycs2c/shadow.git
blueskycs2c
shadow
shadow
master

搜索帮助