diff options
author | liaoyuxiangqin <[email protected]> | 2016-12-10 02:59:36 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-12-09 11:59:36 -0700 |
commit | 00155d395f4154b5de2526bbc0c8a679282cfaee (patch) | |
tree | 92f5ba87422d29544e88c60456439d39bb3e99ed /lib | |
parent | a806cb6a89589d4e1e57a01161b4ce0e2d53523a (diff) |
Fix coverity defects: CID 147475
CID 147475: Logically dead code (DEADCODE)
Reviewed-by: Tim Chase <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: yuxiang <[email protected]>
Closes #5421
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_diff.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c index 419189aa8..c3e7a4472 100644 --- a/lib/libzfs/libzfs_diff.c +++ b/lib/libzfs/libzfs_diff.c @@ -555,11 +555,13 @@ get_snapshot_names(differ_info_t *di, const char *fromsnap, /* * Can accept - * dataset@snap1 - * dataset@snap1 dataset@snap2 - * dataset@snap1 @snap2 - * dataset@snap1 dataset - * @snap1 dataset@snap2 + * fdslen fsnlen tdslen tsnlen + * dataset@snap1 + * 0. dataset@snap1 dataset@snap2 >0 >1 >0 >1 + * 1. dataset@snap1 @snap2 >0 >1 ==0 >1 + * 2. dataset@snap1 dataset >0 >1 >0 ==0 + * 3. @snap1 dataset@snap2 ==0 >1 >0 >1 + * 4. @snap1 dataset ==0 >1 >0 ==0 */ if (tosnap == NULL) { /* only a from snapshot given, must be valid */ @@ -596,8 +598,7 @@ get_snapshot_names(differ_info_t *di, const char *fromsnap, fsnlen = strlen(fromsnap) - fdslen; /* includes @ sign */ tsnlen = strlen(tosnap) - tdslen; /* includes @ sign */ - if (fsnlen <= 1 || tsnlen == 1 || (fdslen == 0 && tdslen == 0) || - (fsnlen == 0 && tsnlen == 0)) { + if (fsnlen <= 1 || tsnlen == 1 || (fdslen == 0 && tdslen == 0)) { return (zfs_error(hdl, EZFS_INVALIDNAME, di->errbuf)); } else if ((fdslen > 0 && tdslen > 0) && ((tdslen != fdslen || strncmp(fromsnap, tosnap, fdslen) != 0))) { |