WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] ioemu: use asprintf instead of PATH_MAX

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] ioemu: use asprintf instead of PATH_MAX
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Wed, 23 Jan 2008 17:20:05 +0000
Delivery-date: Wed, 23 Jan 2008 09:31:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Use asprintf instead of PATH_MAX, which POSIX says to be facultative.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

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");
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>