]> Dogcows Code - chaz/tar/commitdiff
Fix some C compatibility bugs reported by Joerg Schilling.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Nov 2003 06:23:23 +0000 (06:23 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Nov 2003 06:23:23 +0000 (06:23 +0000)
ChangeLog
src/common.h
src/rmt.c
src/system.c
src/system.h
src/tar.c

index bb22a7ba1be983a3ac5b7a133b14a83718daaf40..c7b0ef5abfbf05121067011763a520cc5954c6ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2003-11-12  Paul Eggert  <eggert@twinsun.com>
+
+       Fix some C compatibility bugs reported by Joerg Schilling.
+
+       * src/common.h (stripped_prefix_len): Fix misspelling
+       "stripped_path_len" in declaration.
+       * src/rmt.c (main): Use "return FOO;" rather than
+       "exit (FOO);"; we no longer have to worry about
+       pre-ANSI hosts that mishandled returned values from "main".
+       * src/tar.c (main): Likewise.  This avoids warnings on some
+       compilers.
+       * src/system.c: Include signal.h, for 'kill'.
+       * src/system.h (DEV_BSIZE): Remove.
+       (DEFAULT_ST_BLKSIZE): New macro.
+       (ST_BLKSIZE): Use it, instead of DEV_BSIZE.
+       * src/tar.c (enum): Remove comma just before }.
+       
 2003-11-12  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
 
        * src/list.c (decode_header): Initialize st_atime and
index d9ea6bc435517ab3498495d1184db8d929cfc746..2112f7b5160ce20415c3a9ed32eef26941d5c954 100644 (file)
@@ -581,7 +581,7 @@ char *name_from_list (void);
 void blank_name_list (void);
 char *new_name (const char *, const char *);
 char *safer_name_suffix (char const *, bool);
-size_t stripped_path_len (char const *file_name, size_t num);
+size_t stripped_prefix_len (char const *file_name, size_t num);
 bool all_names_found (struct tar_stat_info *);
 
 bool excluded_name (char const *);
index 79a933dcf6562a17d27fd8835f78069edf708776..1088fa1622976c7da0abd9be2375eadd4614de93 100644 (file)
--- a/src/rmt.c
+++ b/src/rmt.c
@@ -314,7 +314,7 @@ see the file named COPYING for details."));
       if (debug_file == 0)
        {
          report_numbered_error (errno);
-         exit (EXIT_FAILURE);
+         return EXIT_FAILURE;
        }
       setbuf (debug_file, 0);
     }
@@ -395,7 +395,7 @@ top:
                if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
                  {
                    report_error_message (N_("Seek offset out of range"));
-                   exit (EXIT_FAILURE);
+                   return EXIT_FAILURE;
                  }
                count = nc;
              }
@@ -408,7 +408,7 @@ top:
          case 2: whence = SEEK_END; break;
          default:
            report_error_message (N_("Seek direction out of range"));
-           exit (EXIT_FAILURE);
+           return EXIT_FAILURE;
          }
        count = lseek (tape, count, whence);
        if (count < 0)
@@ -449,7 +449,7 @@ top:
                DEBUG (_("rmtd: Premature eof\n"));
 
                report_error_message (N_("Premature end of file"));
-               exit (EXIT_FAILURE); /* exit status used to be 2 */
+               return EXIT_FAILURE; /* exit status used to be 2 */
              }
          }
        status = full_write (tape, record_buffer, size);
@@ -515,7 +515,7 @@ top:
                  if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
                    {
                      report_error_message (N_("Seek offset out of range"));
-                     exit (EXIT_FAILURE);
+                     return EXIT_FAILURE;
                    }
                  count = nc;
                }
@@ -525,7 +525,7 @@ top:
          if (mtop.mt_count != count)
            {
              report_error_message (N_("Seek offset out of range"));
-             exit (EXIT_FAILURE);
+             return EXIT_FAILURE;
            }
          mtop.mt_op = atoi (operation_string);
 
@@ -559,7 +559,7 @@ top:
       DEBUG1 (_("rmtd: Garbage command %c\n"), command);
 
       report_error_message (N_("Garbage command"));
-      exit (EXIT_FAILURE);     /* exit status used to be 3 */
+      return EXIT_FAILURE;     /* exit status used to be 3 */
     }
 
 respond:
index 3b8248063536011af8224af346d02b5f2e50b4b3..37d0496a0edc2c49fe19e9742aef31a87d565b8d 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "common.h"
 #include "rmt.h"
+#include <signal.h>
 
 #if MSDOS
 
index 542015094248dd5914adbb19df6453c39b31ac18..561c42392778b701148f72365ee8fc03154160d3 100644 (file)
@@ -339,28 +339,17 @@ extern int errno;
    size is greater than 512 bytes; so ST_BLKSIZE code below, in preparation
    for some cleanup in this area, later.  */
 
-/* Get or fake the disk device blocksize.  Usually defined by sys/param.h
-   (if at all).  */
-
-#if !defined(DEV_BSIZE) && defined(BSIZE)
-# define DEV_BSIZE BSIZE
-#endif
-#if !defined(DEV_BSIZE) && defined(BBSIZE) /* SGI */
-# define DEV_BSIZE BBSIZE
-#endif
-#ifndef DEV_BSIZE
-# define DEV_BSIZE 4096
-#endif
-
 /* Extract or fake data from a `struct stat'.  ST_BLKSIZE gives the
    optimal I/O blocksize for the file, in bytes.  Some systems, like
    Sequents, return st_blksize of 0 on pipes.  */
 
+#define DEFAULT_ST_BLKSIZE 512
+
 #if !HAVE_ST_BLKSIZE
-# define ST_BLKSIZE(Statbuf) DEV_BSIZE
+# define ST_BLKSIZE(Statbuf) DEFAULT_ST_BLKSIZE
 #else
 # define ST_BLKSIZE(Statbuf) \
-    ((Statbuf).st_blksize > 0 ? (Statbuf).st_blksize : DEV_BSIZE)
+    ((Statbuf).st_blksize > 0 ? (Statbuf).st_blksize : DEFAULT_ST_BLKSIZE)
 #endif
 
 /* Extract or fake data from a `struct stat'.  ST_NBLOCKS gives the
@@ -522,5 +511,3 @@ time_t time ();
 #if XENIX
 # include <sys/inode.h>
 #endif
-
-
index b648c8f25ba91bc67b5d79b2e7c3c6756611ef31..f9a3038573e97fc0d9152fbb5ef9f4c9326dd571 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -218,7 +218,7 @@ enum
   USE_COMPRESS_PROGRAM_OPTION,
   VOLNO_FILE_OPTION,
   WILDCARDS_OPTION,
-  WILDCARDS_MATCH_SLASH_OPTION,
+  WILDCARDS_MATCH_SLASH_OPTION
 };
 
 /* If nonzero, display usage information and exit.  */
@@ -1504,7 +1504,7 @@ main (int argc, char **argv)
     error (0, 0, _("Error exit delayed from previous errors"));
   if (ferror (stderr) || fclose (stderr) != 0)
     exit_status = TAREXIT_FAILURE;
-  exit (exit_status);
+  return exit_status;
 }
 
 void
This page took 0.039882 seconds and 4 git commands to generate.