diff options
author | Jim Meyering <jim@meyering.net> | 2007-07-20 15:22:46 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-07-20 15:22:46 +0000 |
commit | c93e6b5f79d677417d79c62cf1e303f2d8340aed (patch) | |
tree | 37577d0e131d5877d6937f7b30923227f6ab3304 /lib/locking/file_locking.c | |
parent | 57015b12e2f6da25c2556d4c1a5fbe5b3ea7812d (diff) | |
download | lvm2-c93e6b5f79d677417d79c62cf1e303f2d8340aed.tar.gz lvm2-c93e6b5f79d677417d79c62cf1e303f2d8340aed.tar.xz lvm2-c93e6b5f79d677417d79c62cf1e303f2d8340aed.zip |
Introduce is_same_inode macro, now including a comparison of st_dev.
* lib/misc/lvm-file.h (is_same_inode): Define.
* lib/filters/filter-persistent.c (persistent_filter_dump): Use is_same_inode
in place of a direct st_ino-only comparison.
* lib/locking/file_locking.c (_release_lock, _lock_file): Likewise.
Diffstat (limited to 'lib/locking/file_locking.c')
-rw-r--r-- | lib/locking/file_locking.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index 1ac76c17..7361a78d 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -64,7 +64,7 @@ static int _release_lock(const char *file, int unlock) if (!flock(ll->lf, LOCK_NB | LOCK_EX) && !stat(ll->res, &buf1) && !fstat(ll->lf, &buf2) && - !memcmp(&buf1.st_ino, &buf2.st_ino, sizeof(ino_t))) + is_same_inode(buf1, buf2)) if (unlink(ll->res)) log_sys_error("unlink", ll->res); @@ -190,7 +190,7 @@ static int _lock_file(const char *file, int flags) } if (!stat(ll->res, &buf1) && !fstat(ll->lf, &buf2) && - !memcmp(&buf1.st_ino, &buf2.st_ino, sizeof(ino_t))) + is_same_inode(buf1, buf2)) break; } while (!(flags & LCK_NONBLOCK)); |