m4-patches
[Top][All Lists]
Advanced

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

FYI: fix assorted errno gotchas [m4--devo--1.0--patch-5]


From: Gary V. Vaughan
Subject: FYI: fix assorted errno gotchas [m4--devo--1.0--patch-5]
Date: Wed, 4 May 2005 19:58:27 +0100 (BST)
User-agent: mailnotify/0.6

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Applied to HEAD.

  * looking for address@hidden/m4--devo--1.0--patch-4 to compare with
  * comparing to address@hidden/m4--devo--1.0--patch-4
  M  ChangeLog
  M  modules/gnu.c
  M  modules/m4.c
  M  src/main.c
  M  m4/path.c
  
  * modified files
  
  Index: Changelog
  from  Paul Eggert  <address@hidden>

        * src/main.c (print_program_name_CB): Preserve errno, since
        M4ERROR relies on this.
        * modules/gnu.c (m4_esyscmd): Clear errno before calling popen.
        * modules/m4.c (m4_maketemp): Clear errno before calling mkstemp.
        * m4/path.c (m4_path_search): Don't let "free" trash errno when
        returning NULL.
  
  --- orig/m4/path.c
  +++ mod/m4/path.c
  @@ -1,5 +1,7 @@
   /* GNU m4 -- A simple macro processor
  -   Copyright (C) 1989, 90, 91, 92, 93, 98 Free Software Foundation, Inc.
  +
  +   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1998, 2004
  +   Free Software Foundation, Inc.
   
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
  @@ -121,6 +123,7 @@
     FILE *fp;
     m4__search_path *incl;
     char *name;                        /* buffer for constructed name */
  +  int e;
   
     /* Look in current working directory first.  */
     fp = fopen (dir, "r");
  @@ -134,6 +137,7 @@
     /* If file not found, and filename absolute, fail.  */
     if (*dir == '/' || m4_get_no_gnu_extensions_opt (context))
       return NULL;
  +  e= errno;
   
     name = (char *) xmalloc (m4__get_search_path (context)->max_length + 1 + 
strlen (dir) + 1);
   
  @@ -162,6 +166,7 @@
   
     free (name);
   
  +  errno = e;
     return fp;
   }
   
  
  
  --- orig/modules/gnu.c
  +++ mod/modules/gnu.c
  @@ -1,5 +1,5 @@
   /* GNU m4 -- A simple macro processor
  -   Copyright (C) 2000 Free Software Foundation, Inc.
  +   Copyright (C) 2000,2004 Free Software Foundation, Inc.
   
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
  @@ -520,6 +520,7 @@
         int ch;
   
         m4_sysval_flush (context);
  +      errno = 0;
         pin = popen (M4ARG (1), "r");
         if (pin == NULL)
        {
  
  
  --- orig/modules/m4.c
  +++ mod/modules/m4.c
  @@ -611,6 +611,8 @@
   M4BUILTIN_HANDLER (maketemp)
   {
     int fd;
  +
  +  errno = 0;
     if ((fd = mkstemp (M4ARG(1))) < 0)
       {
         M4ERROR ((m4_get_warning_status_opt (context), errno,
  
  
  --- orig/src/main.c
  +++ mod/src/main.c
  @@ -65,10 +65,12 @@
   static void
   print_program_name_CB (void)
   {
  +  int e = errno;
     fflush (stdout);
     fprintf (stderr, "%s: ", program_name);
     if (m4_current_line != 0)
       fprintf (stderr, "%s: %d: ", m4_current_file, m4_current_line);
  +  errno = e;
   }
   
   
  
  
  
- -- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.9
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCeRtSFRMICSmD1gYRAr2zAJ9BzS651361eGgTDh/AI0WfQL5tHwCfdZ3r
Lrsuzqn3dSP8Y0+tfaxCH2U=
=GE02
-----END PGP SIGNATURE-----




reply via email to

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