Readline: Cleanup some warnings
authorAlan Hayward <alan.hayward@arm.com>
Thu, 31 Jan 2019 09:48:39 +0000 (09:48 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Thu, 31 Jan 2019 17:25:06 +0000 (17:25 +0000)
Cleanup the readline warnings that gdb buildbot complains about.

To prevent wcwidth missing declaration warnings, add the SOURCE /
EXTENSION macros to config.in that have already checked for in
configure.

Ensure pid is a long before printing as one.  Also fix GNU style.

Check the return value of write the same way as history_do_write ().

These changes are consistent with upstream readline.

readline/ChangeLog.gdb:

* config.h.in: Add SOURCE/EXTENSION macros.
* histfile.c (history_truncate_file): Check return of write.
* util.c (_rl_tropen): Ensure pid is long.

readline/ChangeLog.gdb
readline/config.h.in
readline/histfile.c
readline/util.c

index f05b9dc52c2e485c2b2b274714de3ab0a4e279cb..c59329ee7d20a5e6d73dce32b1808da86b6c2406 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-31  Alan Hayward  <alan.hayward@arm.com>
+
+       * config.h.in: Add SOURCE/EXTENSION macros.
+       * histfile.c (history_truncate_file): Check return of write.
+       * util.c (_rl_tropen): Ensure pid is long.
+
 2017-05-19  Eli Zaretskii  <eliz@gnu.org>
 
        * input.c [_WIN32]: Include <conio.h> to avoid compiler warning on
index 86d86cfa3da306bb98d330f2d8db728bdd4edfc9..c194e761a457419c4c7f8e0da634f3b3139906fb 100644 (file)
@@ -1,5 +1,15 @@
 /* config.h.in.  Maintained by hand. */
 
+/* Template definitions for autoconf */
+#undef __EXTENSIONS__
+#undef _ALL_SOURCE
+#undef _GNU_SOURCE
+#undef _POSIX_SOURCE
+#undef _POSIX_1_SOURCE
+#undef _POSIX_PTHREAD_SEMANTICS
+#undef _TANDEM_SOURCE
+#undef _MINIX
+
 /* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte
    characters, even if the OS supports them. */
 #undef NO_MULTIBYTE_SUPPORT
index fffeb3fd319e1b5328fd3c1c0f2cf639c9d2d588..56cbbf0498cea34540a2f3eb58a3ee71ec8d2617 100644 (file)
@@ -407,7 +407,8 @@ history_truncate_file (fname, lines)
      truncate to. */
   if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
     {
-      write (file, bp, chars_read - (bp - buffer));
+      if (write (file, bp, chars_read - (bp - buffer)) < 0)
+       rv = errno;
 
 #if defined (__BEOS__)
       /* BeOS ignores O_TRUNC. */
index d402fce842c941737a3ff3b24cffa50d592c8b62..13bd00c09c9c234f9cb157a3f58830830093c376 100644 (file)
@@ -515,11 +515,11 @@ _rl_tropen ()
           (sh_get_env_value ("TEMP")
            ? sh_get_env_value ("TEMP")
            : "."),
-          getpid());
+          getpid ());
 #else
-  sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
+  sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long) getpid ());
 #endif
-  unlink(fnbuf);
+  unlink (fnbuf);
   _rl_tracefp = fopen (fnbuf, "w+");
   return _rl_tracefp != 0;
 }
This page took 0.026948 seconds and 4 git commands to generate.