]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid a -Werror=null-dereference with GCC-6.3.1
authorPádraig Brady <P@draigBrady.com>
Mon, 27 Feb 2017 08:47:30 +0000 (00:47 -0800)
committerPádraig Brady <P@draigBrady.com>
Wed, 1 Mar 2017 03:26:04 +0000 (19:26 -0800)
* src/stty.c (sane_mode): Assert to inform the compiler
we know the pointer will be valid.

src/stty.c

index 4f911a0063adef599c89ced609eaefdeea85f1ac..32007e6df70d2e20e4669a4b44c71ec0f2ef6c4c 100644 (file)
@@ -2268,11 +2268,13 @@ sane_mode (struct termios *mode)
       if (mode_info[i].flags & SANE_SET)
         {
           bitsp = mode_type_flag (mode_info[i].type, mode);
+          assert (bitsp); /* combination modes will not have SANE_SET.  */
           *bitsp = (*bitsp & ~mode_info[i].mask) | mode_info[i].bits;
         }
       else if (mode_info[i].flags & SANE_UNSET)
         {
           bitsp = mode_type_flag (mode_info[i].type, mode);
+          assert (bitsp); /* combination modes will not have SANE_UNSET.  */
           *bitsp = *bitsp & ~mode_info[i].mask & ~mode_info[i].bits;
         }
     }