about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/printf_fphex.c22
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c12
2 files changed, 22 insertions, 12 deletions
diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c
index 00dd8eed1d..b30622080c 100644
--- a/sysdeps/generic/printf_fphex.c
+++ b/sysdeps/generic/printf_fphex.c
@@ -405,7 +405,11 @@ __printf_fphex (FILE *fp,
 	}
     }
   else
-    numend = numstr;
+    {
+      if (precision == -1)
+	precision = 0;
+      numend = numstr;
+    }
 
   /* Now we can compute the exponent string.  */
   expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
@@ -420,7 +424,7 @@ __printf_fphex (FILE *fp,
 
   /* A special case when the mantissa or the precision is zero and the `#'
      is not given.  In this case we must not print the decimal point.  */
-  if ((zero_mantissa || precision == 0) && !info->alt)
+  if (precision == 0 && !info->alt)
     ++width;		/* This nihilates the +1 for the decimal-point
 			   character in the following equation.  */
 
@@ -435,13 +439,16 @@ __printf_fphex (FILE *fp,
     outchar (' ');
 
   outchar ('0');
-  outchar (info->spec == 'A' ? 'X' : 'x');
+  if ('X' - 'A' == 'x' - 'a')
+    outchar (info->spec + ('x' - 'a'));
+  else
+    outchar (info->spec == 'A' ? 'X' : 'x');
   outchar (leading);
 
-  if ((!zero_mantissa && precision > 0) || info->alt)
+  if (precision > 0 || info->alt)
     outchar (decimal);
 
-  if (!zero_mantissa && precision > 0)
+  if (precision > 0)
     {
       PRINT (numstr, MIN (numend - numstr, precision));
       if (precision > numend - numstr)
@@ -451,7 +458,10 @@ __printf_fphex (FILE *fp,
   if (info->left && info->pad == '0' && width > 0)
     PADN ('0', width);
 
-  outchar (info->spec == 'A' ? 'P' : 'p');
+  if ('P' - 'A' == 'p' - 'a')
+    outchar (info->spec + ('p' - 'a'));
+  else
+    outchar (info->spec == 'A' ? 'P' : 'p');
 
   outchar (expnegative ? '-' : '+');
 
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 67fba93cd4..9634aa794f 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -29,7 +29,7 @@
 #include "kernel-features.h"
 
 /* Try to get a socket to talk to the kernel.  */
-#if defined SIOGIFINDEX || defined SIOGIFNAME
+#if defined SIOCGIFINDEX || defined SIOCGIFNAME
 static int
 internal_function
 opensock (void)
@@ -73,7 +73,7 @@ opensock (void)
 unsigned int
 if_nametoindex (const char *ifname)
 {
-#ifndef SIOGIFINDEX
+#ifndef SIOCGIFINDEX
   __set_errno (ENOSYS);
   return 0;
 #else
@@ -84,7 +84,7 @@ if_nametoindex (const char *ifname)
     return 0;
 
   strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
-  if (__ioctl (fd, SIOGIFINDEX, &ifr) < 0)
+  if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
     {
       int saved_errno = errno;
       __close (fd);
@@ -113,7 +113,7 @@ if_freenameindex (struct if_nameindex *ifn)
 struct if_nameindex *
 if_nameindex (void)
 {
-#ifndef SIOGIFINDEX
+#ifndef SIOCGIFINDEX
   __set_errno (ENOSYS);
   return NULL;
 #else
@@ -180,7 +180,7 @@ if_nameindex (void)
       struct ifreq *ifr = &ifc.ifc_req[i];
       idx[i].if_name = __strdup (ifr->ifr_name);
       if (idx[i].if_name == NULL
-	  || __ioctl (fd, SIOGIFINDEX, ifr) < 0)
+	  || __ioctl (fd, SIOCGIFINDEX, ifr) < 0)
 	{
 	  int saved_errno = errno;
 	  unsigned int j;
@@ -207,7 +207,7 @@ if_nameindex (void)
 char *
 if_indextoname (unsigned int ifindex, char *ifname)
 {
-#if !defined SIOGIFINDEX && __ASSUME_SIOCGIFNAME == 0
+#if !defined SIOCGIFINDEX && __ASSUME_SIOCGIFNAME == 0
   __set_errno (ENOSYS);
   return NULL;
 #else