On Monday 03 September 2007, Pascal Terjan wrote: > Le lundi 03 septembre 2007 à 12:05 +0200, Karel Zak a écrit : > > Hi Pascal, > > > > On Mon, Sep 03, 2007 at 12:06:51AM +0200, Pascal Terjan wrote: > > > When editing a disk image, fdisk wants to ask the kernel to reread the > > > partition table which is useless and provokes an error, a wrong exit > > > code and some waiting. This annoys me as I can't check the return code > > > in my script and because I have to wait a few seconds each time. > > > > > > This trivial patch makes it only do the ioctl on block devices. > > > > Please, add "Signed-off-by:" to your patch. > > > > > + fstat(fd, &statbuf); > > > > rc = fstat(fd, &statbuf); > > if (rc == -1) { > > fprintf(stderr, _("re-read partition table: could not stat: %s\n", > > strerror(errno)); > > } else if S_ISBLK(statbuf.st_mode)) { > > .... > > > > Be pedantic :-) > > I fail to imagine how a stat on that fd could fail but OK, I'll send an > updated patch there's plenty of weird corner cases with function calls ... i stopped asking how it could go wrong a while ago :) as long as people dont start checking the return value of close() ... -mike
Attachment:
signature.asc
Description: This is a digitally signed message part.