103 lines
2.7 KiB
Diff
103 lines
2.7 KiB
Diff
From 1b8571add42dfb84637a14032a8d0f1d5dd0e595 Mon Sep 17 00:00:00 2001
|
|
From: peijiankang <peijiankang@kylinos.cn>
|
|
Date: Tue, 14 Mar 2023 15:15:39 +0800
|
|
Subject: [PATCH] delete biometric-authenticationd SingleInstance
|
|
|
|
---
|
|
src/biometric-authenticationd.c | 47 ---------------------------------
|
|
src/biometric-authenticationd.h | 7 -----
|
|
2 files changed, 54 deletions(-)
|
|
|
|
diff --git a/src/biometric-authenticationd.c b/src/biometric-authenticationd.c
|
|
index 240f03f..4a6fb39 100644
|
|
--- a/src/biometric-authenticationd.c
|
|
+++ b/src/biometric-authenticationd.c
|
|
@@ -1598,11 +1598,6 @@ int main()
|
|
int i = 0;
|
|
int ret = 0;
|
|
int uid = getuid();
|
|
- int pid = getpid();
|
|
- char * pid_dir_list[PID_DIR_NUM] = {PID_DIR_0, PID_DIR_1};
|
|
- char * pid_dir = NULL;
|
|
- char pid_file[MAX_PATH_LEN] = {0};
|
|
- char pid_string[MAX_PID_STRING_LEN] = {0};
|
|
|
|
if (uid != 0)
|
|
{
|
|
@@ -1611,45 +1606,6 @@ int main()
|
|
return -1;
|
|
}
|
|
|
|
- for (i = 0; i < PID_DIR_NUM; i++)
|
|
- {
|
|
- struct stat dir_stat;
|
|
-
|
|
- if (access(pid_dir_list[i], F_OK) == 0) {
|
|
- stat(pid_dir_list[i], &dir_stat);
|
|
- if (S_ISDIR(dir_stat.st_mode)) {
|
|
- pid_dir = pid_dir_list[i];
|
|
- break;
|
|
- }
|
|
- }
|
|
- }
|
|
- if (pid_dir == NULL)
|
|
- pid_dir = "/";
|
|
-
|
|
- snprintf(pid_file, MAX_PATH_LEN, "%s/%s.pid", pid_dir, AUTH_SERVER_NAME);
|
|
- int pid_file_fd = open(pid_file, O_CREAT | O_TRUNC | O_RDWR, 0644);
|
|
- if (pid_file_fd < 0)
|
|
- {
|
|
- bio_print_error(_("Can not open PID file: %s\n"), pid_file);
|
|
- return -1;
|
|
- }
|
|
-
|
|
- ret = flock(pid_file_fd, LOCK_EX | LOCK_NB);
|
|
- if (ret < 0)
|
|
- {
|
|
- bio_print_error(_("Biometric authentication server is running, "
|
|
- "Do not restart it repeatedly\n"));
|
|
- return -1;
|
|
- }
|
|
-
|
|
- snprintf(pid_string, MAX_PID_STRING_LEN, "%d\n", pid);
|
|
- ret = write(pid_file_fd, pid_string, strlen(pid_string));
|
|
- if (ret != strlen(pid_string))
|
|
- {
|
|
- bio_print_warning(_("There is an exception to write PID file: %s\n"),
|
|
- pid_file);
|
|
- }
|
|
-
|
|
setlocale (LC_ALL, "");
|
|
bindtextdomain(DOMAIN_NAME, LOCALEDIR);
|
|
textdomain(DOMAIN_NAME);
|
|
@@ -1689,8 +1645,5 @@ int main()
|
|
|
|
UnInitBioDevice();
|
|
|
|
- flock(pid_file_fd, LOCK_UN);
|
|
- close(pid_file_fd);
|
|
-
|
|
return 0;
|
|
}
|
|
diff --git a/src/biometric-authenticationd.h b/src/biometric-authenticationd.h
|
|
index 6baa73b..77a6848 100644
|
|
--- a/src/biometric-authenticationd.h
|
|
+++ b/src/biometric-authenticationd.h
|
|
@@ -29,13 +29,6 @@
|
|
#include "biometric-generated.h"
|
|
#include "dbus_comm.h"
|
|
|
|
-#define PID_DIR_NUM 2
|
|
-#define PID_DIR_0 "/run/user/0/"
|
|
-#define PID_DIR_1 "/tmp/"
|
|
-
|
|
-#define AUTH_SERVER_NAME "biometric-authentication"
|
|
-#define MAX_PID_STRING_LEN 64
|
|
-
|
|
#define SIGNAL_DEV_CHANGED STATUS_TYPE_DEVICE
|
|
#define SIGNAL_OPS_CHANGED STATUS_TYPE_OPERATION
|
|
#define SIGNAL_NOTIFY_CHANGED STATUS_TYPE_NOTIFY
|
|
--
|
|
2.39.1
|
|
|