grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trunk fails to build with -O<anything other than 0>


From: Leif Lindholm
Subject: Re: Trunk fails to build with -O<anything other than 0>
Date: Thu, 31 Jan 2013 14:04:57 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 30/01/13 19:41, Andrey Borzenkov wrote:
В Wed, 30 Jan 2013 18:32:39 +0000
Leif Lindholm <address@hidden> пишет:

Our Ubuntu (12.04/12.10) build environment defaults configuring with
CFLAGS containing -O2. Trunk currently does not build successfully with
this on either my ARM platform or my x86_64 desktop.

I wonder why it did not happen before. Apparently, empty locale.h is
present since 2010-04-10 (rev 2311). Removing it fixes the problem, but
I presume it should not be empty in the first place.

Thank you - I can confirm that this resolves the "gettext" portion of my issue.

Combined with the below (not suggested as a patch, simply to display the issue clearly), trunk now builds with -O2 again.

Regards,

Leif


=== modified file 'grub-core/lib/crypto.c'
--- grub-core/lib/crypto.c      2013-01-11 20:32:42 +0000
+++ grub-core/lib/crypto.c      2013-01-31 13:41:36 +0000
@@ -461,7 +461,8 @@
     }
   else
     tty_changed = 0;
-  fgets (buf, buf_size, stdin);
+  if (fgets (buf, buf_size, stdin) == NULL)
+    return 0;
   ptr = buf + strlen (buf) - 1;
   while (buf <= ptr && (*ptr == '\n' || *ptr == '\r'))
     *ptr-- = 0;

=== modified file 'util/ieee1275/ofpath.c'
--- util/ieee1275/ofpath.c      2013-01-13 21:45:16 +0000
+++ util/ieee1275/ofpath.c      2013-01-31 13:49:44 +0000
@@ -143,7 +143,8 @@
       size = st.st_size;
       of_path = xmalloc (size + MAX_DISK_CAT + 1);
       memset(of_path, 0, size + MAX_DISK_CAT + 1);
-      read(fd, of_path, size);
+      if (read(fd, of_path, size) < 1)
+        return NULL;
       close(fd);

       trim_newline(of_path);
@@ -354,7 +355,8 @@
     grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));

   memset (phy, 0, sizeof (phy));
-  read (fd, phy, sizeof (phy));
+  if (read (fd, phy, sizeof (phy)) < 1)
+    grub_util_warn (_("cannot read `%s': %s"), path, strerror (errno));

   sscanf (phy, "%d", tgt);


/
    Leif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]