On Fri, Dec 24, 2021 at 06:31:39PM +0300, Vladimir Sementsov-Ogievskiy wrote: > > > > > The same is probably in many other places (mkfs-like programs, etc.). > > > > > > > > > > What do you think? > > > > > > > > > > > > > Maybe be we can get filename from fd reading it from /proc, then do > > > > open() and than dup() to old fd.. But that's even more dirty to do > > > > in a library call. > > > > > > Yes, re-open() sounds like a possible way. > > > > > > The dup() is not necessary. The library already support private FD for > > > probing. See blkid_new_probe_from_filename() and BLKID_FL_PRIVATE_FD. > > > > > > It's also often used when the library probe whole-disk device (when you > > > probe sda1 than it also reads data from partition table on sda). In > > > this case it opens a separate FD. > > > > > > It's for floppies (0.001% of all cases). IMHO re-open is good enough and > > > better than force changes in all applications :-)> I'll try to prepare a patch and ask you for test/review. Thanks! > > > > > > > Great! > > > > Hi! Are you working on this? If not I can try to make a v2. I had a vacation in the last 14 days; nothing is done. Go ahead if you have time for this task. I'm going to work on something else this week. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com