Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp> writes: > In the context of some subcommands of QEMU, error_get_progname() can > be used for obtaining argv[0]. The function is useful for the commands > because it is possible to detect a name of executable file and switch > behavior based on the function like busybox. e.g. block drivers can > switch behavior based on the name (qemu itself, qemu-img, or qemu-io).
Changing behavior based on argv[0] is usually a bad idea. Current use of error_get_progname() is limited to error messages and such. That's a good idea. > But calling error_get_progname() in some commands causes segmentation > fault because initialization, calling error_set_progname(), isn't > done. This patchset adds the initialization to the commands which > lacks it but linked to util/qemu-error.o (one exception is bsd-user, because I > don't have an environment which can build and test it). > > Currently, the missing call of error_set_progname() doesn't cause any > problems because the changed commands don't use error_get_progname(). This > patchset is a proactive action (but sheepdog driver will use it soon). I'm fine with calling error_set_progname() in all programs linking with qemu-error.c. I'm reserving judgement on its use in block drivers. Please cc me on that patch. Series Reviewed-by: Markus Armbruster <arm...@redhat.com>