]> git.draconx.ca Git - liblbx.git/commitdiff
liblbx: Fix uninitialized value warning in pipe_seek.
authorNick Bowler <nbowler@draconx.ca>
Tue, 28 Jan 2014 02:43:42 +0000 (21:43 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 28 Jan 2014 02:43:42 +0000 (21:43 -0500)
If whence is invalid then we will proceed with an uninitialized value.
However, unlike the similar problem in lbx_file_seek, pipe_seek is an
internal function so this scenario can Never Happen™.

Add an assertion to silence the warning.

src/fops.c

index 26b392f2146667b0550bc1555f047966d7249808..5ae349faa33ea6057b8c51dc475a57e79b03d572 100644 (file)
@@ -18,6 +18,7 @@
  */
 #include <stdio.h>
 #include <errno.h>
+#include <assert.h>
 
 #include "misc.h"
 #include "error.h"
@@ -87,6 +88,8 @@ static int pipe_seek(void *handle, long offset, int whence)
        case SEEK_END:
                distance = -1;
                break;
+       default:
+               assert(0);
        }
 
        if (distance < 0)