Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MhBI6-00047J-VW for mharc-grub-devel@gnu.org; Fri, 28 Aug 2009 19:55:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhBI5-000461-KD for grub-devel@gnu.org; Fri, 28 Aug 2009 19:55:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhBI1-00041K-Ma for grub-devel@gnu.org; Fri, 28 Aug 2009 19:55:33 -0400 Received: from [199.232.76.173] (port=38276 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhBI1-00040o-Fr for grub-devel@gnu.org; Fri, 28 Aug 2009 19:55:29 -0400 Received: from xvm-190-8.ghst.net ([217.70.190.8]:37118 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MhBI0-0005iO-L5 for grub-devel@gnu.org; Fri, 28 Aug 2009 19:55:28 -0400 Received: from [192.168.10.10] (helo=localhost) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1MhBHm-0004Ha-Ul for grub-devel@gnu.org; Sat, 29 Aug 2009 01:55:15 +0200 Received: from rmh by localhost with local (Exim 4.69) (envelope-from ) id 1MhBHm-0004f0-DV for grub-devel@gnu.org; Sat, 29 Aug 2009 01:55:14 +0200 Date: Sat, 29 Aug 2009 01:55:14 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090828235514.GA17856@thorin> References: <1251463992.2547.24.camel@fz.local> <20090828162828.GB14976@thorin> <1251482319.2547.48.camel@fz.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1251482319.2547.48.camel@fz.local> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATH] grub-mkrelpath X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2009 23:55:34 -0000 On Fri, Aug 28, 2009 at 07:58:39PM +0200, Felix Zielcke wrote: > +#else /* ! HAVE_REALPATH */ > + grub_util_warn ("grub-mkrelpath might not work on your OS correctly."); > + /* make relative path absolute. */ > + if (*path != '/') > + { > + len = 1024; > + buf2 = xmalloc (len); > + do > + { > + buf2 = getcwd (buf2, len); > + if (buf2 == NULL) > + { > + if (errno != ERANGE) > + grub_util_error ("can not get current working directory"); > + else > + len *= 2; > + buf2 = xrealloc (buf2, len); > + } > + } while (buf2 == NULL); > + buf = xmalloc (strlen (path) + strlen (buf2) + 1); > + strcpy (buf, buf2); > + strcat (buf, "/"); > + strcat (buf, path); > + } > + else > + buf = strdup (path); > +#endif /* ! HAVE_REALPATH */ Please can you leave this part out? realpath() is POSIX, so it should be present in all systems we support, and if it isn't, we should be using a complete implementation from Gnulib instead, but we don't need to worry about this untill/unless someone reports it as a problem. > + p = strrchr (buf, '/'); > + if (p == NULL) > + grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)"); Does this ever happen? -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."