On 01/12/2010 02:27 PM, Adam Jackson wrote: > On Tue, 2010-01-12 at 13:48 -0800, H. Peter Anvin wrote: >> On 01/12/2010 01:00 PM, Adam Jackson wrote: >>> On Sat, 2010-01-09 at 01:05 +0100, Guillem Jover wrote: >>> >>>>> + if (!*loop) { >>>>> + struct stat st_buf; >>>>> + stat(*spec, &st_buf); >>>>> + *loop = S_ISREG(st_buf.st_mode); >>>> >>>> Shouldn't you check if stat was successful before using st_buf? >>> >>> Yeah, I suppose. I think we've already stat'd the file once before >>> this, so I doubt it'd ever fail, but might as well be sure. >> >> It could fail if the file is moved out from underneath. > > Although true, that's not really distinguishable from the file moving > after the stat but before the mount. We'd need an fmount() syscall to > really escape that race. > Actually, in this case it's not a mount, but the LOOP_SET_FD ioctl, which *does* take a file descriptor. -hpa -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html