From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZPkd-0004gF-EU for qemu-devel@nongnu.org; Sun, 23 Sep 2007 07:35:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZPkY-0004Zz-Is for qemu-devel@nongnu.org; Sun, 23 Sep 2007 07:35:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZPkY-0004Zl-BW for qemu-devel@nongnu.org; Sun, 23 Sep 2007 07:35:46 -0400 Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IZPkX-0002rB-Q6 for qemu-devel@nongnu.org; Sun, 23 Sep 2007 07:35:46 -0400 Date: Sun, 23 Sep 2007 12:34:46 +0100 (BST) From: Johannes Schindelin Subject: Re: [Qemu-devel] Re: [PATCH] vvfat mbr fixes In-Reply-To: Message-ID: References: <219e947f0709221443l494e4c46w6efafce989dbb867@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lorenzo Campedelli Cc: qemu-devel@nongnu.org Hi, On Sun, 23 Sep 2007, Lorenzo Campedelli wrote: > While you are working on vvfat issues, could you give a look to the > attached small patch? Okay, this is what I would do: - not make this handling dependent on vvfat (but this means checking if the colon is the second character, because then it is most likely a Windows path and does _not_ want special handling), and - I'd use the result of strrchr() directly. This is a sketch of the code I propose: const char *tmp; ... get_tmp_filename(tmp_filename, sizeof(tmp_filename)); /* Handle 'fat:rw:' */ tmp = strrchr(backing_filename, ':'); if (tmp - backing_filename == 2) /* DOS path */ tmp = NULL; else if (tmp - backing_filename > 2 && tmp[-2] == ':') tmp -= 2; realpath(filename, tmp ? tmp : backing_filename); Ciao, Dscho