summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
blob: 85efaf226056d2f7eabe8426c63edb3af2b4d2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index 136ac69..a35bb2b 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -34,7 +34,7 @@ static const char default_file_name[] = _PATH_UTMP;
 static const char *static_ut_name = default_file_name;
 
 /* This function must be called with the LOCK held */
-static void __setutent_nolock(void)
+static void __setutent_unlocked(void)
 {
     if (static_fd < 0) {
 	static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
@@ -56,12 +56,12 @@ static void __setutent_nolock(void)
 static void __setutent(void)
 {
     __UCLIBC_MUTEX_LOCK(utmplock);
-    __setutent_nolock();
+    __setutent_unlocked();
     __UCLIBC_MUTEX_UNLOCK(utmplock);
 }
 #else
 static void __setutent(void);
-strong_alias(__setutent_nolock,__setutent)
+strong_alias(__setutent_unlocked,__setutent)
 #endif
 strong_alias(__setutent,setutent)
 
@@ -70,7 +70,7 @@ strong_alias(__setutent,setutxent)
 #endif
 
 /* This function must be called with the LOCK held */
-static struct utmp *__getutent_lock(void)
+static struct utmp *__getutent_unlocked(void)
 {
     if (static_fd < 0) {
 	__setutent();
@@ -91,13 +91,13 @@ static struct utmp *__getutent(void)
     struct utmp *ret;
 
     __UCLIBC_MUTEX_LOCK(utmplock);
-    ret = __getutent_lock();
+    ret = __getutent_unlocked();
     __UCLIBC_MUTEX_UNLOCK(utmplock);
     return ret;
 }
 #else
 static struct utmp *__getutent(void);
-strong_alias(__getutent_lock,__getutent)
+strong_alias(__getutent_unlocked,__getutent)
 #endif
 strong_alias(__getutent,getutent)
 
@@ -123,7 +123,7 @@ strong_alias(__endutent,endutxent)
 #endif
 
 /* This function must be called with the LOCK held */
-static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
+static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
 {
     struct utmp *lutmp;
     unsigned type;
@@ -133,7 +133,7 @@ static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
     type = utmp_entry->ut_type - 1;
     type /= 4;
 
-    while ((lutmp = __getutent()) != NULL) {
+    while ((lutmp = __getutent_unlocked()) != NULL) {
 	if (type == 0 && lutmp->ut_type == utmp_entry->ut_type)	{
 	    /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
 	    return lutmp;
@@ -152,13 +152,13 @@ static struct utmp *__getutid(const struct utmp *utmp_entry)
     struct utmp *ret;
 
     __UCLIBC_MUTEX_LOCK(utmplock);
-    ret = __getutid_lock(utmp_entry);
+    ret = __getutid_unlocked(utmp_entry);
     __UCLIBC_MUTEX_UNLOCK(utmplock);
     return ret;
 }
 #else
 static struct utmp *__getutid(const struct utmp *utmp_entry);
-strong_alias(__getutid_lock,__getutid)
+strong_alias(__getutid_unlocked,__getutid)
 #endif
 strong_alias(__getutid,getutid)
 
@@ -174,7 +174,7 @@ static struct utmp *__getutline(const struct utmp *utmp_entry)
     struct utmp *lutmp;
 
     __UCLIBC_MUTEX_LOCK(utmplock);
-    while ((lutmp = __getutent()) != NULL) {
+    while ((lutmp = __getutent_unlocked()) != NULL) {
 	if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
 	    if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
 		break;
@@ -200,7 +200,7 @@ static struct utmp *__pututline(const struct utmp *utmp_entry)
        the file pointer where they want it, everything will work out. */
     lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
 
-    if (__getutid(utmp_entry) != NULL)
+    if (__getutid_unlocked(utmp_entry) != NULL)
 	lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
     else
 	lseek(static_fd, (off_t) 0, SEEK_END);