]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add file_lock_get_path()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 21 Jun 2017 22:42:56 +0000 (01:42 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 3 Jul 2017 12:13:24 +0000 (15:13 +0300)
This allows getting the file path from the lock without having to preserve
it separately.

src/lib/file-lock.c
src/lib/file-lock.h

index 18efadc134ada3dcee6057ddb0d02a345f189941..32404f4204e36b175d02f2999dc08bcca9f67ff3 100644 (file)
@@ -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);
index 046b807aa0dfff2aab0622a6fe9497c7639b223d..c0d62211cf2284014228e03e5637ce04f7c83822 100644 (file)
@@ -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,