diff options
author | Mike Fulbright <msf@redhat.com> | 2002-12-03 03:06:25 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2002-12-03 03:06:25 +0000 |
commit | 72447ce3ff28e53c5871403f8bfc0bc9186663ee (patch) | |
tree | 11324a25536462cfbdaa34563858bd9a14c66db7 /isys | |
parent | 79a744c854896908190e1b33ba2055002610c4ee (diff) | |
download | anaconda-72447ce3ff28e53c5871403f8bfc0bc9186663ee.tar.gz anaconda-72447ce3ff28e53c5871403f8bfc0bc9186663ee.tar.xz anaconda-72447ce3ff28e53c5871403f8bfc0bc9186663ee.zip |
make this function return 1 is its an ISO, 0 otherwise
Diffstat (limited to 'isys')
-rw-r--r-- | isys/isofs.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/isys/isofs.c b/isys/isofs.c index 5ba255ff9..1f954a225 100644 --- a/isys/isofs.c +++ b/isys/isofs.c @@ -4,6 +4,7 @@ #define BLOCK_SIZE 2048 +/* returns 1 if file is an ISO, 0 otherwise */ int fileIsIso(const char * file) { int blkNum; char magic[5]; @@ -11,25 +12,25 @@ int fileIsIso(const char * file) { fd = open(file, O_RDONLY); if (fd < 0) - return 1; + return 0; for (blkNum = 16; blkNum < 100; blkNum++) { if (lseek(fd, blkNum * BLOCK_SIZE + 1, SEEK_SET) < 0) { close(fd); - return 1; + return 0; } if (read(fd, magic, sizeof(magic)) != sizeof(magic)) { close(fd); - return 1; + return 0; } if (!strncmp(magic, "CD001", 5)) { close(fd); - return 0; + return 1; } } close(fd); - return 1; + return 0; } |