[libmultipath] 0 _is_ a valid file descriptor
authorChristophe Varoqui <root@xa-s05.(none)>
Fri, 30 Sep 2005 11:40:28 +0000 (13:40 +0200)
committerChristophe Varoqui <root@xa-s05.(none)>
Fri, 30 Sep 2005 11:40:28 +0000 (13:40 +0200)
Stefan Bader, IBM

libmultipath/cache.c
libmultipath/discovery.c
libmultipath/structs.c

index 81fc613..342f736 100644 (file)
@@ -12,7 +12,7 @@ static void
 revoke_cache_info(struct path * pp)
 {
        pp->checker_context = NULL;
-       pp->fd = 0;
+       pp->fd = -1;
        pp->mpp = NULL;
        pp->getuid = NULL;
        pp->getprio = NULL;
index e295eae..cc08d1a 100644 (file)
@@ -228,7 +228,7 @@ get_claimed(char * devname)
 {
        int fd = opennode(devname, O_EXCL);
 
-       if (fd <= 0 && errno == EBUSY)
+       if (fd < 0 && errno == EBUSY)
                return 1;
 
        close(fd);
@@ -604,10 +604,10 @@ pathinfo (struct path *pp, vector hwtable, int mask)
                pp->claimed = get_claimed(pp->dev);
                condlog(3, "claimed = %i", pp->claimed);
        }
-       if (pp->fd <= 0)
+       if (pp->fd < 0)
                pp->fd = opennode(pp->dev, O_RDONLY);
 
-       if (pp->fd <= 0)
+       if (pp->fd < 0)
                goto out;
 
        if (pp->bus == SYSFS_BUS_SCSI &&
index 4c26986..1c70423 100644 (file)
@@ -33,7 +33,7 @@ free_path (struct path * pp)
        if (pp->checker_context)
                free(pp->checker_context);
 
-       if (pp->fd > 0)
+       if (pp->fd >= 0)
                close(pp->fd);
 
        FREE(pp);