@@ -307,14 +307,12 @@ static int sparsebundle_read_process_band(const char *band_path, size_t length,
307307 length, uintmax_t (offset), static_cast <void *>(*buffer));
308308
309309 int band_file_fd = sparsebundle_open_file (band_path);
310- if (band_file_fd != -1 ) {
311- read = pread (band_file_fd, *buffer, length, offset);
312- if (read == -1 ) {
313- syslog (LOG_ERR, " failed to read band: %s" , strerror (errno));
314- return -errno;
315- }
316- } else if (errno != ENOENT) {
317- syslog (LOG_ERR, " failed to open band %s: %s" , band_path, strerror (errno));
310+ if (band_file_fd == -1 )
311+ return -errno;
312+
313+ read = pread (band_file_fd, *buffer, length, offset);
314+ if (read == -1 ) {
315+ syslog (LOG_ERR, " failed to read band: %s" , strerror (errno));
318316 return -errno;
319317 }
320318
@@ -361,14 +359,12 @@ static int sparsebundle_read_buf_process_band(const char *band_path, size_t leng
361359 uintmax_t (offset));
362360
363361 int band_file_fd = sparsebundle_open_file (band_path);
364- if (band_file_fd != -1 ) {
365- struct stat band_stat;
366- stat (band_path, &band_stat);
367- read += max (off_t (0 ), min (static_cast <off_t >(length), band_stat.st_size - offset));
368- } else if (errno != ENOENT) {
369- syslog (LOG_ERR, " failed to open band %s: %s" , band_path, strerror (errno));
362+ if (band_file_fd == -1 )
370363 return -errno;
371- }
364+
365+ struct stat band_stat;
366+ stat (band_path, &band_stat);
367+ read += max (off_t (0 ), min (static_cast <off_t >(length), band_stat.st_size - offset));
372368
373369 if (read > 0 ) {
374370 fuse_buf buffer = { read, fuse_buf_flags (FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK), 0 , band_file_fd, offset };
0 commit comments