summaryrefslogtreecommitdiff
path: root/src/basic/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 19:08:09 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:25:55 +0100
commite929bee09ab8000e87b7e825ed3a78d73ecdd7f0 (patch)
tree5e1fc6e11dec6ab46fb9497fb9915b65ad37d8af /src/basic/util.c
parentbb15fafe9cd815fe5bf9eae84c08aead2eb98fd7 (diff)
util-lib: move take_password_lock() to user-util.[ch]
Also, rename it take_etc_passwd_lock(), in order to make it more expressive.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r--src/basic/util.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index 576c6238d6..2ee5de9cd0 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -2096,46 +2096,6 @@ int update_reboot_param_file(const char *param) {
return 0;
}
-int take_password_lock(const char *root) {
-
- struct flock flock = {
- .l_type = F_WRLCK,
- .l_whence = SEEK_SET,
- .l_start = 0,
- .l_len = 0,
- };
-
- const char *path;
- int fd, r;
-
- /* This is roughly the same as lckpwdf(), but not as awful. We
- * don't want to use alarm() and signals, hence we implement
- * our own trivial version of this.
- *
- * Note that shadow-utils also takes per-database locks in
- * addition to lckpwdf(). However, we don't given that they
- * are redundant as they they invoke lckpwdf() first and keep
- * it during everything they do. The per-database locks are
- * awfully racy, and thus we just won't do them. */
-
- if (root)
- path = strjoina(root, "/etc/.pwd.lock");
- else
- path = "/etc/.pwd.lock";
-
- fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0600);
- if (fd < 0)
- return -errno;
-
- r = fcntl(fd, F_SETLKW, &flock);
- if (r < 0) {
- safe_close(fd);
- return -errno;
- }
-
- return fd;
-}
-
int is_symlink(const char *path) {
struct stat info;