]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: move unreachable code to preprocessor #else block [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Wed, 15 Oct 2014 21:19:25 +0000 (22:19 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Oct 2014 12:07:18 +0000 (14:07 +0200)
eject.c:466 toggle_tray() info: ignoring unreachable code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/eject.c

index 91f1102abbc9aeef4048ba998b09bdbd242968c7..860610f5ae4faac8e74fccbd6eec5ebfd5670c2f 100644 (file)
@@ -433,9 +433,6 @@ static int eject_cdrom(int fd)
  */
 static void toggle_tray(int fd)
 {
-       struct timeval time_start, time_stop;
-       int time_elapsed;
-
 #ifdef CDROM_DRIVE_STATUS
        /* First ask the CDROM for info, otherwise fall back to manual.  */
        switch (ioctl(fd, CDROM_DRIVE_STATUS)) {
@@ -457,7 +454,9 @@ static void toggle_tray(int fd)
        default:
                abort();
        }
-#endif
+#else
+       struct timeval time_start, time_stop;
+       int time_elapsed;
 
        /* Try to open the CDROM tray and measure the time therefor
         * needed.  In my experience the function needs less than 0.05
@@ -481,6 +480,7 @@ static void toggle_tray(int fd)
         * closed before. This would mean that we are done.  */
        if (time_elapsed < TRAY_WAS_ALREADY_OPEN_USECS)
                close_tray(fd);
+#endif
 }
 
 /*