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).
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). v2: - pass argv[0] directly to error_set_progname() without calling basename - add initialization to commands other than qemu-io The thread of v1 can be found here: http://lists.gnu.org/archive/html/qemu-devel/2014-08/msg01502.html Hitoshi Mitake (4): qemu-io: initialize progname with error_set_progname() qemu-nbd: initialize progname with error_set_progname() qga: initialize progname with error_set_progname() linux-user: initialize progname with error_set_progname() linux-user/main.c | 2 ++ qemu-io.c | 1 + qemu-nbd.c | 1 + qga/main.c | 1 + 4 files changed, 5 insertions(+) -- 1.9.1