Revision 65d21bc7

b/block/raw-posix.c
242 242

  
243 243
    ret = pread(s->fd, buf, count, offset);
244 244
    if (ret == count)
245
        goto label__raw_read__success;
245
        return ret;
246 246

  
247 247
    /* Allow reads beyond the end (needed for pwrite) */
248 248
    if ((ret == 0) && bs->growable) {
249 249
        int64_t size = raw_getlength(bs);
250 250
        if (offset >= size) {
251 251
            memset(buf, 0, count);
252
            ret = count;
253
            goto label__raw_read__success;
252
            return count;
254 253
        }
255 254
    }
256 255

  
......
260 259
                      bs->total_sectors, ret, errno, strerror(errno));
261 260

  
262 261
    /* Try harder for CDrom. */
263
    if (bs->type == BDRV_TYPE_CDROM) {
262
    if (s->type != FTYPE_FILE) {
264 263
        ret = pread(s->fd, buf, count, offset);
265 264
        if (ret == count)
266
            goto label__raw_read__success;
265
            return ret;
267 266
        ret = pread(s->fd, buf, count, offset);
268 267
        if (ret == count)
269
            goto label__raw_read__success;
268
            return ret;
270 269

  
271 270
        DEBUG_BLOCK_PRINT("raw_pread(%d:%s, %" PRId64 ", %p, %d) [%" PRId64
272 271
                          "] retry read failed %d : %d = %s\n",
......
274 273
                          bs->total_sectors, ret, errno, strerror(errno));
275 274
    }
276 275

  
277
label__raw_read__success:
278

  
279 276
    return  (ret < 0) ? -errno : ret;
280 277
}
281 278

  
......
298 295

  
299 296
    ret = pwrite(s->fd, buf, count, offset);
300 297
    if (ret == count)
301
        goto label__raw_write__success;
298
        return ret;
302 299

  
303 300
    DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" PRId64
304 301
                      "] write failed %d : %d = %s\n",
305 302
                      s->fd, bs->filename, offset, buf, count,
306 303
                      bs->total_sectors, ret, errno, strerror(errno));
307 304

  
308
label__raw_write__success:
309

  
310 305
    return  (ret < 0) ? -errno : ret;
311 306
}
312 307

  

Also available in: Unified diff