diff options
author | Gedare Bloom <gedare@rtems.org> | 2013-09-05 13:22:49 -0400 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-09-05 13:22:49 -0400 |
commit | 121dd88103d306760c43a06bc27b3641b68cf542 (patch) | |
tree | e483d2d4daa29a67ed8d9b785fa242783a72e3ab /cpukit/libblock | |
parent | dosfs: Unsigned compared against 0 (diff) | |
download | rtems-121dd88103d306760c43a06bc27b3641b68cf542.tar.bz2 |
bdpart: Argument cannot be negative
If open(fd) fails then avoid the error path that calls close(fd).
Diffstat (limited to 'cpukit/libblock')
-rw-r--r-- | cpukit/libblock/src/bdpart-read.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cpukit/libblock/src/bdpart-read.c b/cpukit/libblock/src/bdpart-read.c index fd8a038dfe..cfb31d5ac8 100644 --- a/cpukit/libblock/src/bdpart-read.c +++ b/cpukit/libblock/src/bdpart-read.c @@ -74,7 +74,7 @@ rtems_status_code rtems_bdpart_get_disk_data( { rtems_status_code sc = RTEMS_SUCCESSFUL; int rv = 0; - int fd = -1; + int fd; rtems_disk_device *dd = NULL; rtems_blkdev_bnum disk_begin = 0; rtems_blkdev_bnum block_size = 0; @@ -83,7 +83,7 @@ rtems_status_code rtems_bdpart_get_disk_data( fd = open( disk_name, O_RDWR); if (fd < 0) { sc = RTEMS_INVALID_NAME; - goto error; + goto out; } /* Get disk handle */ @@ -119,6 +119,7 @@ error: close( fd); } +out: return sc; } |