aboutsummaryrefslogtreecommitdiff
path: root/src/main/extractor_datasource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/extractor_datasource.c')
-rw-r--r--src/main/extractor_datasource.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/extractor_datasource.c b/src/main/extractor_datasource.c
index 0b18d7c..9f51d90 100644
--- a/src/main/extractor_datasource.c
+++ b/src/main/extractor_datasource.c
@@ -229,7 +229,7 @@ bfds_pick_next_buffer_at (struct BufferedFileDataSource *bfds,
229 bfds->buffer_pos = pos; 229 bfds->buffer_pos = pos;
230 return 0; 230 return 0;
231 } 231 }
232 position = (int64_t) LSEEK (bfds->fd, pos, SEEK_SET); 232 position = (int64_t) lseek (bfds->fd, pos, SEEK_SET);
233 if (position < 0) 233 if (position < 0)
234 { 234 {
235 LOG_STRERROR ("lseek"); 235 LOG_STRERROR ("lseek");
@@ -1214,38 +1214,38 @@ EXTRACTOR_datasource_create_from_file_ (const char *filename,
1214 winmode = O_BINARY; 1214 winmode = O_BINARY;
1215#endif 1215#endif
1216 1216
1217 if (-1 == (fd = OPEN (filename, O_RDONLY | O_LARGEFILE | winmode))) 1217 if (-1 == (fd = open (filename, O_RDONLY | O_LARGEFILE | winmode)))
1218 { 1218 {
1219 LOG_STRERROR_FILE ("open", filename); 1219 LOG_STRERROR_FILE ("open", filename);
1220 return NULL; 1220 return NULL;
1221 } 1221 }
1222 if ( (0 != FSTAT (fd, &sb)) || 1222 if ( (0 != fstat (fd, &sb)) ||
1223 (S_ISDIR (sb.st_mode)) ) 1223 (S_ISDIR (sb.st_mode)) )
1224 { 1224 {
1225 if (! S_ISDIR (sb.st_mode)) 1225 if (! S_ISDIR (sb.st_mode))
1226 LOG_STRERROR_FILE ("fstat", filename); 1226 LOG_STRERROR_FILE ("fstat", filename);
1227 else 1227 else
1228 LOG ("Skipping directory `%s'\n", filename); 1228 LOG ("Skipping directory `%s'\n", filename);
1229 (void) CLOSE (fd); 1229 (void) close (fd);
1230 return NULL; 1230 return NULL;
1231 } 1231 }
1232 fsize = (int64_t) sb.st_size; 1232 fsize = (int64_t) sb.st_size;
1233 if (0 == fsize) 1233 if (0 == fsize)
1234 { 1234 {
1235 (void) CLOSE (fd); 1235 (void) close (fd);
1236 return NULL; 1236 return NULL;
1237 } 1237 }
1238 bfds = bfds_new (NULL, fd, fsize); 1238 bfds = bfds_new (NULL, fd, fsize);
1239 if (NULL == bfds) 1239 if (NULL == bfds)
1240 { 1240 {
1241 (void) CLOSE (fd); 1241 (void) close (fd);
1242 return NULL; 1242 return NULL;
1243 } 1243 }
1244 if (NULL == (ds = malloc (sizeof (struct EXTRACTOR_Datasource)))) 1244 if (NULL == (ds = malloc (sizeof (struct EXTRACTOR_Datasource))))
1245 { 1245 {
1246 LOG_STRERROR ("malloc"); 1246 LOG_STRERROR ("malloc");
1247 bfds_delete (bfds); 1247 bfds_delete (bfds);
1248 (void) CLOSE (fd); 1248 (void) close (fd);
1249 return NULL; 1249 return NULL;
1250 } 1250 }
1251 ds->bfds = bfds; 1251 ds->bfds = bfds;
@@ -1261,7 +1261,7 @@ EXTRACTOR_datasource_create_from_file_ (const char *filename,
1261 LOG ("Failed to initialize decompressor\n"); 1261 LOG ("Failed to initialize decompressor\n");
1262 bfds_delete (bfds); 1262 bfds_delete (bfds);
1263 free (ds); 1263 free (ds);
1264 (void) CLOSE (fd); 1264 (void) close (fd);
1265 return NULL; 1265 return NULL;
1266 } 1266 }
1267 } 1267 }
@@ -1333,7 +1333,7 @@ EXTRACTOR_datasource_destroy_ (struct EXTRACTOR_Datasource *ds)
1333 cfs_destroy (ds->cfs); 1333 cfs_destroy (ds->cfs);
1334 bfds_delete (ds->bfds); 1334 bfds_delete (ds->bfds);
1335 if (-1 != ds->fd) 1335 if (-1 != ds->fd)
1336 (void) CLOSE (ds->fd); 1336 (void) close (ds->fd);
1337 free (ds); 1337 free (ds);
1338} 1338}
1339 1339