Another interesting thing you can do with this plugin:
https://rwmj.wordpress.com/2019/02/19/nbdkit-linuxdisk-plugin/
v2:
- Fix inconsistent tab/space.
- All 3 plugins now contain a block of text pointing to the
other 2 plugins.
- TMDIR -> TMPDIR
- Unlink the temporary file and other cleanups along error paths.
- fclose -> pclose, and check the return value for errors.
- There's an extra commit containing a minor change to TODO. I will
probably push this.
I considered, but didn't yet fix, the latent bug in shell_quote.
Instead I added a comment. Note there's a case where we probably
(arguably) should be using shell_quote on an argv[0] here:
https://github.com/libguestfs/nbdkit/blob/72e0afe2e280d895f68941677fafa55...
'du -c -k -s' works on FreeBSD which doesn't have GNU coreutils.
(However I agree it's not very natural to use this plugin with FreeBSD
at all.)
The return from 'chdir (origdir)' is checked on the normal path, and
not checked only on the error path where we're only trying to make a
best effort clean-up.
Rich.