lib: [loopdev.c] fix use of logical '&&' with constant operand
Subsystems (2)
PATCH 1/2 lib: [loopdev.c] fix use of logical '&&' with constant operand
Found by clang.
Signed-off-by Francesco Cosoleto <[email protected]>
--- lib/loopdev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
lib/loopdev.c +2 -2
@@ -116,7 +116,7 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags) lc->flags = flags;loopcxt_set_device (lc,NULL ); -if (!(lc->flags &&LOOPDEV_FL_NOSYSFS ) && +if (!(lc->flags &LOOPDEV_FL_NOSYSFS ) &&get_linux_version () >=KERNEL_VERSION (2 ,6 ,37 ))/* * Use only sysfs for basic information about loop devices
@@ -244,7 +244,7 @@ int loopcxt_init_iterator(struct loopdev_cxt *lc, int flags)/* * Check for /dev/loop/<N> subdirectory */ -if (!(lc->flags &&LOOPDEV_FL_DEVSUBDIR ) && +if (!(lc->flags &LOOPDEV_FL_DEVSUBDIR ) &&stat (_PATH_DEV_LOOP, &st) ==0 &&S_ISDIR (st.st_mode)) lc->flags |=LOOPDEV_FL_DEVSUBDIR ;
Signature · 1 line
1.7.3.4
PATCH 2/2 libmount: fix use of logical '&&' with constant operand
Found by clang.
Signed-off-by Francesco Cosoleto <[email protected]>
--- libmount/src/context_loopdev.c | 2 +- libmount/src/context_mount.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libmount/src/context_loopdev.c +1 -1
@@ -52,7 +52,7 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt) type =mnt_fs_get_fstype (cxt->fs); fl =__mnt_fs_get_flags (cxt->fs); -if (!(fl && (MNT_FS_PSEUDO |MNT_FS_NET |MNT_FS_SWAP )) && +if (!(fl & (MNT_FS_PSEUDO |MNT_FS_NET |MNT_FS_SWAP )) && (!type ||strcmp (type,"auto" ) ==0 ||blkid_known_fstype (type))) {struct stat st;
libmount/src/context_mount.c +1 -1
@@ -125,7 +125,7 @@ static int fix_optstr(struct libmnt_context *cxt) goto done; } -if (!rc && cxt->user_mountflags &&MNT_MS_USER ) +if (!rc && cxt->user_mountflags &MNT_MS_USER ) rc =mnt_optstr_fix_user (&fs->user_optstr);/* refresh merged optstr */
Signature · 1 line
1.7.3.4
Re: [PATCH 2/2] libmount: fix use of logical '&&' with constant operand
Quoted 3 lines · Francesco Cosoleto
libmount/src/context_loopdev.c | 2 +- libmount/src/context_mount.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 2 lines · Francesco Cosoleto
lib/loopdev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com