pud: fix closing fd
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 12:20:16 +0000 (14:20 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 13:02:51 +0000 (15:02 +0200)
Coverity:
CID 739704 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
At (7): "fd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/posFile.c

index 7be49e5..6f1ddd8 100644 (file)
@@ -305,7 +305,7 @@ bool readPositionFile(char * fileName, nmeaINFO * nmeaInfo) {
        out: if (fp) {
                fclose(fp);
        }
-       if (fd) {
+       if (fd >= 0) {
                close(fd);
        }
        return retval;