+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
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 *);
if (debug_file == 0)
{
report_numbered_error (errno);
- exit (EXIT_FAILURE);
+ return EXIT_FAILURE;
}
setbuf (debug_file, 0);
}
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;
}
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)
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);
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;
}
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);
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:
#include "common.h"
#include "rmt.h"
+#include <signal.h>
#if MSDOS
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
#if XENIX
# include <sys/inode.h>
#endif
-
-
USE_COMPRESS_PROGRAM_OPTION,
VOLNO_FILE_OPTION,
WILDCARDS_OPTION,
- WILDCARDS_MATCH_SLASH_OPTION,
+ WILDCARDS_MATCH_SLASH_OPTION
};
/* If nonzero, display usage information and exit. */
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