From: Timo Sirainen Date: Wed, 21 Jun 2017 22:42:56 +0000 (+0300) Subject: lib: Add file_lock_get_path() X-Git-Tag: 2.3.0.rc1~1368 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f1243d7759a3dddc1c3eaf7eda8a153c8ef0112b;p=thirdparty%2Fdovecot%2Fcore.git lib: Add file_lock_get_path() This allows getting the file path from the lock without having to preserve it separately. --- diff --git a/src/lib/file-lock.c b/src/lib/file-lock.c index 29fe971998..4881e284a1 100644 --- a/src/lib/file-lock.c +++ b/src/lib/file-lock.c @@ -367,6 +367,11 @@ void file_lock_free(struct file_lock **_lock) i_free(lock); } +const char *file_lock_get_path(struct file_lock *lock) +{ + return lock->path; +} + void file_lock_wait_start(void) { i_assert(lock_wait_start.tv_sec == 0); diff --git a/src/lib/file-lock.h b/src/lib/file-lock.h index 046b807aa0..c0d62211cf 100644 --- a/src/lib/file-lock.h +++ b/src/lib/file-lock.h @@ -51,6 +51,9 @@ void file_unlock(struct file_lock **lock); /* Free the lock without unlocking it (because you're closing the fd anyway). */ void file_lock_free(struct file_lock **lock); +/* Returns the path given as parameter to file_*lock*(). */ +const char *file_lock_get_path(struct file_lock *lock); + /* Returns human-readable string containing the process that has the file currently locked. Returns "" if unknown, otherwise " (string)". */ const char *file_lock_find(int lock_fd, enum file_lock_method lock_method,