ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
63 stars 59 forks source link

dasd_is_ro in libdasd/dasd_ioctl.c doesn't close the DASD volume before exiting #77

Closed markkp closed 4 years ago

markkp commented 4 years ago

Most the routines in dasd_ioctl.c open a file descriptor for the device that is passed to them, perform an operation on it, and then close the file descriptor before returning. The dasd_is_ro routine doesn't do that: int dasd_is_ro(const char device, bool ro) { int fd, val;

fd = dasd_open_device(device, O_RDWR);
RUN_IOCTL(fd, BLKROGET, &val);
*ro = (val != 0) ? true : false;

return 0;

}

From what I can tell, dasdfmt exits while it still has an open file descriptor for the DASD volume being formatted. Is this expected, or a bug?

hoeppnerj commented 4 years ago

Hi Mark,

that's definitely a bug. Good catch. I will fix it.