From a3605bf696a30e793d375b6c4ff1fd88ec546010 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Sat, 25 May 2013 13:17:21 +0400 Subject: don't run pkg-config for features explicitly disabled We test pkg-config for curses and curl even if those are explicitly disabled. Move these tests inside `if "$feature" != "no"' sections. Signed-off-by: Michael Tokarev --- configure | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 918dc36..269382a 100755 --- a/configure +++ b/configure @@ -2153,13 +2153,12 @@ fi ########################################## # curses probe -if test "$mingw32" = "yes" ; then +if test "$curses" != "no" ; then + if test "$mingw32" = "yes" ; then curses_list="-lpdcurses" -else + else curses_list="-lncurses:-lcurses:$($pkg_config --libs ncurses 2>/dev/null)" -fi - -if test "$curses" != "no" ; then + fi curses_found=no cat > $TMPC << EOF #include @@ -2191,14 +2190,12 @@ fi ########################################## # curl probe - -if $pkg_config libcurl --modversion >/dev/null 2>&1; then - curlconfig="$pkg_config libcurl" -else - curlconfig=curl-config -fi - if test "$curl" != "no" ; then + if $pkg_config libcurl --modversion >/dev/null 2>&1; then + curlconfig="$pkg_config libcurl" + else + curlconfig=curl-config + fi cat > $TMPC << EOF #include int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } -- cgit v1.1 From 6681fca3fc5f44eff68a0c0b2e62694f8579ce28 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 24 May 2013 12:19:25 +0200 Subject: Remove unnecessary break statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix these warnings from cppcheck: hw/display/cirrus_vga.c:2603: hw/sd/sd.c:348: hw/timer/exynos4210_mct.c:1033: target-arm/translate.c:9886: target-s390x/mem_helper.c:518: target-unicore32/translate.c:1936: style: Consecutive return, break, continue, goto or throw statements are unnecessary. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- hw/display/cirrus_vga.c | 1 - hw/timer/exynos4210_mct.c | 1 - target-arm/translate.c | 1 - target-s390x/mem_helper.c | 1 - target-unicore32/translate.c | 1 - 5 files changed, 5 deletions(-) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 64bfe2b..a5dbc39 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -2600,7 +2600,6 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val, #endif cirrus_vga_write_sr(c, val); break; - break; case 0x3c6: cirrus_write_hidden_dac(c, val); break; diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 87ce75b..38dcc1a 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1030,7 +1030,6 @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset, case G_INT_ENB: value = s->g_timer.reg.int_enb; break; - break; case G_WSTAT: value = s->g_timer.reg.wstat; break; diff --git a/target-arm/translate.c b/target-arm/translate.c index 71135bd..b3f26d6 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -9916,7 +9916,6 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, invalidate this TB. */ dc->pc += 2; goto done_generating; - break; } } } diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c index 02bc432..1422ae9 100644 --- a/target-s390x/mem_helper.c +++ b/target-s390x/mem_helper.c @@ -515,7 +515,6 @@ uint32_t HELPER(ex)(CPUS390XState *env, uint32_t cc, uint64_t v1, break; default: goto abort; - break; } } else if ((insn & 0xff00) == 0x0a00) { /* supervisor call */ diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c index 151e35e..3dc7856 100644 --- a/target-unicore32/translate.c +++ b/target-unicore32/translate.c @@ -1933,7 +1933,6 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, invalidate this TB. */ dc->pc += 2; /* FIXME */ goto done_generating; - break; } } } -- cgit v1.1 From 8c1f72da6b11051c48a642f7de7048956383e217 Mon Sep 17 00:00:00 2001 From: liguang Date: Fri, 24 May 2013 10:47:31 +0800 Subject: debugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON when use DEBUG_DEBUGCON, screen spits: debugcon: write addr=0x0000 val=0x00 Rdebugcon: write addr=0x0000 val=0x00 udebugcon: write addr=0x0000 val=0x00 ndebugcon: write addr=0x0000 val=0x00 ndebugcon: write addr=0x0000 val=0x00 idebugcon: write addr=0x0000 val=0x00 ndebugcon: write addr=0x0000 val=0x00 gdebugcon: write addr=0x0000 val=0x00 debugcon: write addr=0x0000 val=0x00 odebugcon: write addr=0x0000 val=0x00 pdebugcon: write addr=0x0000 val=0x00 tdebugcon: write addr=0x0000 val=0x00 idebugcon: write addr=0x0000 val=0x00 odebugcon: write addr=0x0000 val=0x00 ndebugcon: write addr=0x0000 val=0x00 debugcon: write addr=0x0000 val=0x00 rdebugcon: write addr=0x0000 val=0x00 odebugcon: write addr=0x0000 val=0x00 mdebugcon: write addr=0x0000 val=0x00 debugcon: write addr=0x0000 val=0x00 adebugcon: write addr=0x0000 val=0x00 tdebugcon: write addr=0x0000 val=0x00 debugcon: write addr=0x0000 val=0x00 Oh, that's wrong, val is not always be 0. this bug caused by lack of length modifier for specifier 'x'. Signed-off-by: liguang Signed-off-by: Michael Tokarev --- hw/char/debugcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 02c9577..7e41c90 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -55,7 +55,7 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val, unsigned char ch = val; #ifdef DEBUG_DEBUGCON - printf("debugcon: write addr=0x%04x val=0x%02x\n", addr, val); + printf("debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02x\n", addr, val); #endif qemu_chr_fe_write(s->chr, &ch, 1); -- cgit v1.1 From e6ee28469fc41af5cc7d5b470ec9a1a078177fa7 Mon Sep 17 00:00:00 2001 From: liguang Date: Fri, 24 May 2013 10:47:32 +0800 Subject: debugcon: make debug message more readable before change: Bdebugcon: write addr=0x0000 val=0x6f odebugcon: write addr=0x0000 val=0x6f odebugcon: write addr=0x0000 val=0x74 tdebugcon: write addr=0x0000 val=0x69 idebugcon: write addr=0x0000 val=0x6e ndebugcon: write addr=0x0000 val=0x67 gdebugcon: write addr=0x0000 val=0x20 debugcon: write addr=0x0000 val=0x66 after change: B [debugcon: write addr=0x0000 val=0x6f] o [debugcon: write addr=0x0000 val=0x6f] o [debugcon: write addr=0x0000 val=0x74] t [debugcon: write addr=0x0000 val=0x69] i [debugcon: write addr=0x0000 val=0x6e] n [debugcon: write addr=0x0000 val=0x67] g [debugcon: write addr=0x0000 val=0x20] [debugcon: write addr=0x0000 val=0x66] Signed-off-by: liguang Signed-off-by: Michael Tokarev --- hw/char/debugcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 7e41c90..52fa0ab 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -55,7 +55,7 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val, unsigned char ch = val; #ifdef DEBUG_DEBUGCON - printf("debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02x\n", addr, val); + printf(" [debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02x]\n", addr, val); #endif qemu_chr_fe_write(s->chr, &ch, 1); -- cgit v1.1 From 668fca91d48a7d55a0e3911447b078679f2ce986 Mon Sep 17 00:00:00 2001 From: liguang Date: Fri, 24 May 2013 10:47:33 +0800 Subject: debugcon: fix compiler warning when open DEBUG_DEBUGCON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit compiler warnings: CC hw/char/debugcon.o hw/char/debugcon.c: In function ‘debugcon_ioport_write’: hw/char/debugcon.c:58: warning: format ‘%02x’ expects type ‘unsigned int’, but argument 3 has type ‘uint64_t’ hw/char/debugcon.c: In function ‘debugcon_ioport_read’: hw/char/debugcon.c:70: warning: format ‘%04x’ expects type ‘unsigned int’, but argument 2 has type ‘hwaddr’ Signed-off-by: liguang Signed-off-by: Michael Tokarev --- hw/char/debugcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 52fa0ab..3b0637d 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -55,7 +55,7 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val, unsigned char ch = val; #ifdef DEBUG_DEBUGCON - printf(" [debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02x]\n", addr, val); + printf(" [debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02" PRIx64 "]\n", addr, val); #endif qemu_chr_fe_write(s->chr, &ch, 1); @@ -67,7 +67,7 @@ static uint64_t debugcon_ioport_read(void *opaque, hwaddr addr, unsigned width) DebugconState *s = opaque; #ifdef DEBUG_DEBUGCON - printf("debugcon: read addr=0x%04x\n", addr); + printf("debugcon: read addr=0x%04" HWADDR_PRIx "\n", addr); #endif return s->readback; -- cgit v1.1 From cbc8d595ef21635b630dd1cad54eb730ae6620a1 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 22 May 2013 09:21:39 -0400 Subject: configure: remove confusing file manipulation The configure script had some code to manipulate config-host.ld~ (i.e., a common backup filename), comparing it with the newly-generated file. I believe the sense of the comparison was backwards. Since it seemed to serve little purpose anyway, remove it to avoid any confusion. Signed-off-by: Ed Maste Signed-off-by: Michael Tokarev --- configure | 9 --------- 1 file changed, 9 deletions(-) diff --git a/configure b/configure index 269382a..e17281e 100755 --- a/configure +++ b/configure @@ -4104,17 +4104,8 @@ if test "$gcov" = "yes" ; then fi # generate list of library paths for linker script - $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} -if test -f ${config_host_ld}~ ; then - if cmp -s $config_host_ld ${config_host_ld}~ ; then - mv ${config_host_ld}~ $config_host_ld - else - rm ${config_host_ld}~ - fi -fi - # use included Linux headers if test "$linux" = "yes" ; then mkdir -p linux-headers -- cgit v1.1 From d2d6b8576ccf0de429fb96ea6ab9669d8e916085 Mon Sep 17 00:00:00 2001 From: Lei Li Date: Mon, 20 May 2013 17:20:50 +0800 Subject: linux-user: Fix typo in comment Signed-off-by: Lei Li Reviewed-by: Stefan Weil Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1b3c0ed..0099d64 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8236,7 +8236,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_madvise case TARGET_NR_madvise: /* A straight passthrough may not be safe because qemu sometimes - turns private flie-backed mappings into anonymous mappings. + turns private file-backed mappings into anonymous mappings. This will break MADV_DONTNEED. This is a hint, so ignoring and returning success is ok. */ ret = get_errno(0); -- cgit v1.1 From d720e9831cab9934079d36a5fe3ebcdded4cb3a7 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Wed, 22 May 2013 13:33:12 +0800 Subject: rtc: remove rtc_set_date Since it's not defined and used anywhere. Cc: qemu-trivial@nongnu.org Signed-off-by: Hu Tao Signed-off-by: Michael Tokarev --- include/hw/timer/mc146818rtc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h index 753dda6..eaf6497 100644 --- a/include/hw/timer/mc146818rtc.h +++ b/include/hw/timer/mc146818rtc.h @@ -9,6 +9,5 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq); void rtc_set_memory(ISADevice *dev, int addr, int val); int rtc_get_memory(ISADevice *dev, int addr); -void rtc_set_date(ISADevice *dev, const struct tm *tm); #endif /* !MC146818RTC_H */ -- cgit v1.1 From cfeda5f4b8710b6ba14131df8e287021b729b784 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 24 May 2013 16:07:00 -0400 Subject: configure: try pkg-config ncurses first When probing for ncurses, try pkg-config first rather than after explicit -lncurses and -lcurses. This fixes static linking in the case that ncurses has additional dependencies, such as -ltinfo (as on FreeBSD). Signed-off-by: Ed Maste Signed-off-by: Michael Tokarev --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index e17281e..08ceb43 100755 --- a/configure +++ b/configure @@ -2157,7 +2157,7 @@ if test "$curses" != "no" ; then if test "$mingw32" = "yes" ; then curses_list="-lpdcurses" else - curses_list="-lncurses:-lcurses:$($pkg_config --libs ncurses 2>/dev/null)" + curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses" fi curses_found=no cat > $TMPC << EOF -- cgit v1.1 From 7465dfeca065882c93424b23b14b2c9f31b16aa5 Mon Sep 17 00:00:00 2001 From: Lei Li Date: Mon, 27 May 2013 18:33:01 +0800 Subject: docs: Fix typo and update file in migration This patch fix some typo and update the file that already moved. Signed-off-by: Lei Li Signed-off-by: Michael Tokarev --- docs/migration.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/migration.txt b/docs/migration.txt index 0719a55..0e0a1d4 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -41,7 +41,7 @@ All these four migration protocols use the same infrastructure to save/restore state devices. This infrastructure is shared with the savevm/loadvm functionality. -=== State Live Migration == +=== State Live Migration === This is used for RAM and block devices. It is not yet ported to vmstate. @@ -83,7 +83,7 @@ pointer that is passed to all functions. The important functions for us are put_buffer()/get_buffer() that allow to write/read a buffer into the QEMUFile. -=== How to save the state of one device == +=== How to save the state of one device === The state of a device is saved using intermediate buffers. There are some helper functions to assist this saving. @@ -97,7 +97,7 @@ associated with a series of fields saved. The save_state always saves the state as the newer version. But load_state sometimes is able to load state from an older version. - === Legacy way === +=== Legacy way === This way is going to disappear as soon as all current users are ported to VMSTATE. @@ -133,7 +133,7 @@ to interpret that definition to be able to load/save the state. As the state is declared only once, it can't go out of sync in the save/load functions. -An example (from hw/pckbd.c) +An example (from hw/input/pckbd.c) static const VMStateDescription vmstate_kbd = { .name = "pckbd", @@ -158,9 +158,9 @@ We registered this with: Note: talk about how vmstate <-> qdev interact, and what the instance ids mean. You can search for VMSTATE_* macros for lots of types used in QEMU in -hw/hw.h. +include/hw/hw.h. -=== More about versions == +=== More about versions === You can see that there are several version fields: @@ -227,7 +227,7 @@ using a specific functionality, .... It is impossible to create a way to make migration from any version to any other version to work. But we can do better than only allowing -migration from older versions no newer ones. For that fields that are +migration from older versions to newer ones. For that fields that are only needed sometimes, we add the idea of subsections. A subsection is "like" a device vmstate, but with a particularity, it has a Boolean function that tells if that values are needed to be sent or not. If @@ -247,7 +247,8 @@ static bool ide_drive_pio_state_needed(void *opaque) { IDEState *s = opaque; - return (s->status & DRQ_STAT) != 0; + return ((s->status & DRQ_STAT) != 0) + || (s->bus->error_status & BM_STATUS_PIO_RETRY); } const VMStateDescription vmstate_ide_drive_pio_state = { -- cgit v1.1 From 12cd30e9c026e03db908785276057c5a3d912596 Mon Sep 17 00:00:00 2001 From: Lei Li Date: Mon, 27 May 2013 18:33:02 +0800 Subject: migration: Remove duplicate bandwidth_limit set bandwidth_limit is double set in migrate_init(), remove one. Signed-off-by: Lei Li Signed-off-by: Michael Tokarev --- migration.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration.c b/migration.c index bfbc345..058f9e6 100644 --- a/migration.c +++ b/migration.c @@ -349,7 +349,6 @@ static MigrationState *migrate_init(const MigrationParams *params) sizeof(enabled_capabilities)); memset(s, 0, sizeof(*s)); - s->bandwidth_limit = bandwidth_limit; s->params = *params; memcpy(s->enabled_capabilities, enabled_capabilities, sizeof(enabled_capabilities)); -- cgit v1.1 From a9c34e4485ef0a8a61e88f1c9f9bb87f00ba2c72 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Tue, 28 May 2013 00:46:10 +0400 Subject: slirp: cleanup leftovers from misc.h There are quite a few leftover declarations in slirp/misc.h. Remove them. Signed-off-by: Michael Tokarev --- slirp/misc.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/slirp/misc.h b/slirp/misc.h index cc36aeb..ba8beb1 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -20,8 +20,6 @@ struct ex_list { char *strdup(const char *); #endif -void do_wait(int); - #define EMU_NONE 0x0 /* TCP emulations */ @@ -51,21 +49,9 @@ struct emu_t { struct emu_t *next; }; -extern int x_port, x_server, x_display; - -int show_x(char *, struct socket *); -void redir_x(uint32_t, int, int, int); void slirp_insque(void *, void *); void slirp_remque(void *); int add_exec(struct ex_list **, int, char *, struct in_addr, int); -int slirp_openpty(int *, int *); int fork_exec(struct socket *so, const char *ex, int do_pty); -void snooze_hup(int); -void snooze(void); -void relay(int); -void add_emu(char *); -void fd_nonblock(int); -void fd_block(int); -int rsh_exec(struct socket *, struct socket *, char *, char *, char *); #endif -- cgit v1.1 From a585140dd546ffb606ec506b362ab9decf1ab14e Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Wed, 29 May 2013 23:30:43 +1000 Subject: qemu: fix out of tree cross compile The symlink to "asm" platform linux headers is made in the build tree by the configure script but gcc is not told to look for them there. The patch fixes this. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Tokarev --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 08ceb43..d5abf98 100755 --- a/configure +++ b/configure @@ -546,7 +546,7 @@ Haiku) if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then audio_possible_drivers="$audio_possible_drivers fmod" fi - QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers $QEMU_INCLUDES" + QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" ;; esac -- cgit v1.1 From cd2e64ce306910f6a627d899e6779eda33f8511c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 29 May 2013 09:58:29 -0400 Subject: m25p80: Add Micron n25q032a Based on the datasheet at http://www.micron.com/~/media/Documents/Products/Data%20Sheet/NOR%20Flash/Serial%20NOR/N25Q/n25q_32mb_1_8v_65nm.pdf Signed-off-by: Ed Maste Signed-off-by: Michael Tokarev --- hw/block/m25p80.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 759c84d..a927a6b 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -123,6 +123,7 @@ static const FlashPartInfo known_devices[] = { { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, /* Micron */ + { INFO("n25q032a", 0x20bb16, 0, 64 << 10, 64, ER_4K) }, { INFO("n25q128a11", 0x20bb18, 0, 64 << 10, 256, 0) }, { INFO("n25q128a13", 0x20ba18, 0, 64 << 10, 256, 0) }, { INFO("n25q256a", 0x20ba19, 0, 64 << 10, 512, ER_4K) }, -- cgit v1.1 From a4cc73d629d43c8a4d171d043ff229a959df3ca6 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 31 May 2013 14:00:27 +0200 Subject: do not check pointers after dereferencing them Two instances, both spotted by Coverity. In one, two blocks were swapped. In the other, the check is not needed anymore. Cc: qemu-stable@nongnu.org Cc: qemu-trivial@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- monitor.c | 2 +- savevm.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 6ce2a4e..eefc7f0 100644 --- a/monitor.c +++ b/monitor.c @@ -280,7 +280,7 @@ void monitor_flush(Monitor *mon) buf = qstring_get_str(mon->outbuf); len = qstring_get_length(mon->outbuf); - if (mon && len && !mon->mux_out) { + if (len && !mon->mux_out) { rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len); if (rc == len) { /* all flushed */ diff --git a/savevm.c b/savevm.c index 31dcce9..4e0fab6 100644 --- a/savevm.c +++ b/savevm.c @@ -322,13 +322,13 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode) FILE *stdio_file; QEMUFileStdio *s; - stdio_file = popen(command, mode); - if (stdio_file == NULL) { + if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { + fprintf(stderr, "qemu_popen: Argument validity check failed\n"); return NULL; } - if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { - fprintf(stderr, "qemu_popen: Argument validity check failed\n"); + stdio_file = popen(command, mode); + if (stdio_file == NULL) { return NULL; } -- cgit v1.1