summaryrefslogtreecommitdiffstats
path: root/libmount/src
diff options
context:
space:
mode:
authorSami Kerola2017-05-28 11:21:48 +0200
committerKarel Zak2017-06-14 12:19:20 +0200
commit1b5042636fa92c977d9a033f685ceb7f3c4c5fc9 (patch)
tree39b83786d289855a5ba6cb51fe0ac10e2707e481 /libmount/src
parentisosize: avoid reading more data than what is needed (diff)
downloadkernel-qcow2-util-linux-1b5042636fa92c977d9a033f685ceb7f3c4c5fc9.tar.gz
kernel-qcow2-util-linux-1b5042636fa92c977d9a033f685ceb7f3c4c5fc9.tar.xz
kernel-qcow2-util-linux-1b5042636fa92c977d9a033f685ceb7f3c4c5fc9.zip
misc: fix reassigned values before old ones has been used [cppcheck]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/btrfs.c2
-rw-r--r--libmount/src/cache.c6
-rw-r--r--libmount/src/context.c2
-rw-r--r--libmount/src/context_umount.c2
-rw-r--r--libmount/src/optstr.c2
-rw-r--r--libmount/src/tab_diff.c4
-rw-r--r--libmount/src/tab_update.c2
7 files changed, 10 insertions, 10 deletions
diff --git a/libmount/src/btrfs.c b/libmount/src/btrfs.c
index c387fadd5..e6e8aebff 100644
--- a/libmount/src/btrfs.c
+++ b/libmount/src/btrfs.c
@@ -101,7 +101,7 @@ uint64_t btrfs_get_default_subvol_id(const char *path)
{
int iocret;
int fd;
- DIR *dirstream = NULL;
+ DIR *dirstream;
struct btrfs_ioctl_search_args args;
struct btrfs_ioctl_search_key *sk = &args.key;
struct btrfs_ioctl_search_header *sh;
diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index 6ff997140..b52ca8098 100644
--- a/libmount/src/cache.c
+++ b/libmount/src/cache.c
@@ -489,9 +489,9 @@ char *mnt_get_fstype(const char *devname, int *ambi, struct libmnt_cache *cache)
static char *canonicalize_path_and_cache(const char *path,
struct libmnt_cache *cache)
{
- char *p = NULL;
- char *key = NULL;
- char *value = NULL;
+ char *p;
+ char *key;
+ char *value;
DBG(CACHE, ul_debugobj(cache, "canonicalize path %s", path));
p = canonicalize_path(path);
diff --git a/libmount/src/context.c b/libmount/src/context.c
index 5725ab1ad..fdbb02585 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -1965,7 +1965,7 @@ static int apply_table(struct libmnt_context *cxt, struct libmnt_table *tb,
int direction)
{
struct libmnt_fs *fs = NULL;
- const char *src = NULL, *tgt = NULL;
+ const char *src, *tgt;
int rc;
assert(cxt);
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index e0b7bda11..37fdf2668 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -485,7 +485,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
*/
if (u_flags & (MNT_MS_USER | MNT_MS_OWNER | MNT_MS_GROUP)) {
- char *curr_user = NULL;
+ char *curr_user;
char *mtab_user = NULL;
size_t sz;
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index 4b9622ed5..8248f0dee 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -382,7 +382,7 @@ insert_value(char **str, char *pos, const char *substr, char **next)
size_t strsz = strlen(*str);
size_t possz = strlen(pos);
size_t posoff;
- char *p = NULL;
+ char *p;
int sep;
/* is it necessary to prepend '=' before the substring ? */
diff --git a/libmount/src/tab_diff.c b/libmount/src/tab_diff.c
index 7cf9e57ef..6caaa2a2d 100644
--- a/libmount/src/tab_diff.c
+++ b/libmount/src/tab_diff.c
@@ -305,8 +305,8 @@ done:
static int test_diff(struct libmnt_test *ts, int argc, char *argv[])
{
- struct libmnt_table *tb_old = NULL, *tb_new = NULL;
- struct libmnt_tabdiff *diff = NULL;
+ struct libmnt_table *tb_old, *tb_new;
+ struct libmnt_tabdiff *diff;
struct libmnt_iter *itr;
struct libmnt_fs *old, *new;
int rc = -1, change;
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index d85cb89da..52e1dd444 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -291,7 +291,7 @@ static int utab_new_entry(struct libmnt_update *upd, struct libmnt_fs *fs,
unsigned long mountflags)
{
int rc = 0;
- const char *o = NULL, *a = NULL;
+ const char *o, *a;
char *u = NULL;
assert(fs);