diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-07-20 14:41:39 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-07-20 15:58:38 +0100 |
commit | 1d0f398d8e3c74ce6a70cbbb8d9b8ae07c6d7ef6 (patch) | |
tree | 70844e48ea3b632709ff07847df041e40e1830fa /daemon/blkid.c | |
parent | 168fd4ad5d1e5da93e11388095d41aaa8f804ceb (diff) | |
download | libguestfs-1d0f398d8e3c74ce6a70cbbb8d9b8ae07c6d7ef6.tar.gz libguestfs-1d0f398d8e3c74ce6a70cbbb8d9b8ae07c6d7ef6.tar.xz libguestfs-1d0f398d8e3c74ce6a70cbbb8d9b8ae07c6d7ef6.zip |
blkid: Use -c /dev/null option to kill the cache.
On recent Debian, /etc/blkid.tab is now a symlink to /dev/.blkid.tab.
Rather than chasing the cache file around (it may move to /run in future)
use the -c /dev/null option to stop blkid from reading the cache.
Diffstat (limited to 'daemon/blkid.c')
-rw-r--r-- | daemon/blkid.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/daemon/blkid.c b/daemon/blkid.c index f6310611..7935ac3f 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -33,16 +33,11 @@ get_blkid_tag (const char *device, const char *tag) char *out, *err; int r; - /* Kill the cache file, forcing blkid to reread values from the - * original filesystems. In blkid there is a '-p' option which is - * supposed to do this, but (a) it doesn't work and (b) that option - * is not supported in RHEL 5. - */ - unlink ("/etc/blkid/blkid.tab"); /* Red Hat, Fedora */ - unlink ("/etc/blkid.tab"); /* Debian */ - r = commandr (&out, &err, - "blkid", "-o", "value", "-s", tag, device, NULL); + "blkid", + /* Adding -c option kills all caching, even on RHEL 5. */ + "-c", "/dev/null", + "-o", "value", "-s", tag, device, NULL); if (r != 0 && r != 2) { if (r >= 0) reply_with_error ("%s: %s (blkid returned %d)", device, err, r); |