diff options
author | Karel Zak | 2009-11-11 15:26:49 +0100 |
---|---|---|
committer | Karel Zak | 2009-11-11 15:26:49 +0100 |
commit | 9e0f7bda1964b512e24a2f39b7e82f60fea7a980 (patch) | |
tree | be54c56f1794fce1f9ef1e05f834de2a861436e1 /shlibs/blkid/src/probe.c | |
parent | po: update pl.po (from translationproject.org) (diff) | |
download | kernel-qcow2-util-linux-9e0f7bda1964b512e24a2f39b7e82f60fea7a980.tar.gz kernel-qcow2-util-linux-9e0f7bda1964b512e24a2f39b7e82f60fea7a980.tar.xz kernel-qcow2-util-linux-9e0f7bda1964b512e24a2f39b7e82f60fea7a980.zip |
libblkid: properly reset position in probing chains
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r-- | shlibs/blkid/src/probe.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 0324351ab..6267a2a54 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -247,6 +247,12 @@ void blkid_probe_chain_reset_vals(blkid_probe pr, struct blkid_chain *chn) pr->nvals = nvals; } +static void blkid_probe_chain_reset_position(struct blkid_chain *chn) +{ + if (chn) + chn->idx = -1; +} + /* * Copies chain values from probing result to @vals, the max size of @vals is * @nvals and returns real number of values. @@ -298,13 +304,14 @@ void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn) return NULL; pr->cur_chain = chn; - chn->idx = -1; /* start probing from scratch */ chn->binary = TRUE; + blkid_probe_chain_reset_position(chn); rc = chn->driver->probe(pr, chn); chn->binary = FALSE; pr->cur_chain = NULL; + blkid_probe_chain_reset_position(chn); if (rc != 0) return NULL; @@ -336,7 +343,7 @@ void blkid_reset_probe(blkid_probe pr) pr->cur_chain = NULL; for (i = 0; i < BLKID_NCHAINS; i++) - pr->chains[i].idx = -1; + blkid_probe_chain_reset_position(&pr->chains[i]); } /*** @@ -381,7 +388,7 @@ unsigned long *blkid_probe_get_filter(blkid_probe pr, int chain, int create) /* always when you touch the chain filter all indexes are reseted and * probing starts from scratch */ - chn->idx = -1; + blkid_probe_chain_reset_position(chn); pr->cur_chain = NULL; if (!chn->driver->has_fltr || (!chn->fltr && !create)) @@ -754,10 +761,13 @@ int blkid_do_safeprobe(blkid_probe pr) if (!chn->enabled) continue; - chn->idx = - 1; + blkid_probe_chain_reset_position(chn); - /* rc: -2 ambivalent, -1 = error, 0 = success, 1 = no result */ rc = chn->driver->safeprobe(pr, chn); + + blkid_probe_chain_reset_position(chn); + + /* rc: -2 ambivalent, -1 = error, 0 = success, 1 = no result */ if (rc < 0) goto done; /* error */ if (rc == 0) @@ -804,10 +814,13 @@ int blkid_do_fullprobe(blkid_probe pr) if (!chn->enabled) continue; - chn->idx = - 1; + blkid_probe_chain_reset_position(chn); - /* rc: -1 = error, 0 = success, 1 = no result */ rc = chn->driver->probe(pr, chn); + + blkid_probe_chain_reset_position(chn); + + /* rc: -1 = error, 0 = success, 1 = no result */ if (rc < 0) goto done; /* error */ if (rc == 0) |