From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] ioemu: use asprintf instead of PATH_MAX Date: Wed, 23 Jan 2008 17:20:05 +0000 Message-ID: <20080123172005.GI5188@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Use asprintf instead of PATH_MAX, which POSIX says to be facultative. Signed-off-by: Samuel Thibault diff -r c364f80eb4b5 tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Wed Jan 23 13:27:21 2008 +0000 +++ b/tools/ioemu/target-i386-dm/helper2.c Wed Jan 23 17:18:56 2008 +0000 @@ -635,7 +635,7 @@ extern int suspend_requested; CPUState *env = cpu_single_env; int evtchn_fd = xce_handle == -1 ? -1 : xc_evtchn_fd(xce_handle); - char qemu_file[PATH_MAX]; + char *qemu_file; fd_set fds; int ret = 0; @@ -665,9 +665,9 @@ main_loop_wait(1); /* For the select() on events */ /* Save the device state */ - snprintf(qemu_file, sizeof(qemu_file), - "/var/lib/xen/qemu-save.%d", domid); + asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid); do_savevm(qemu_file); + free(qemu_file); xenstore_record_dm_state("paused");