Skip to content

Commit f964972

Browse files
authored
bsdtar: start "fake short equivalents" enum higher (libarchive#2586)
This avoids possible conflict with command-line options such as -B.
1 parent 948a52d commit f964972

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

tar/bsdtar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ need_report(void)
104104
static __LA_NORETURN void long_help(void);
105105
static void only_mode(struct bsdtar *, const char *opt,
106106
const char *valid);
107-
static void set_mode(struct bsdtar *, char opt);
107+
static void set_mode(struct bsdtar *, int opt);
108108
static __LA_NORETURN void version(void);
109109

110110
/* A basic set of security flags to request from libarchive. */
@@ -139,7 +139,7 @@ main(int argc, char **argv)
139139
{
140140
struct bsdtar *bsdtar, bsdtar_storage;
141141
int opt, t;
142-
char compression, compression2;
142+
int compression, compression2;
143143
const char *compression_name, *compression2_name;
144144
const char *compress_program;
145145
char *tptr, *uptr;
@@ -938,7 +938,7 @@ main(int argc, char **argv)
938938
switch (compression) {
939939
case 'J': case 'j': case 'y': case 'Z': case 'z':
940940
strcpy(buff, "-?");
941-
buff[1] = compression;
941+
buff[1] = (char)compression;
942942
break;
943943
default:
944944
strcpy(buff, "--");
@@ -1008,7 +1008,7 @@ main(int argc, char **argv)
10081008
}
10091009

10101010
static void
1011-
set_mode(struct bsdtar *bsdtar, char opt)
1011+
set_mode(struct bsdtar *bsdtar, int opt)
10121012
{
10131013
if (bsdtar->mode != '\0' && bsdtar->mode != opt)
10141014
lafe_errc(1, 0,

tar/bsdtar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct bsdtar {
4242
int uid; /* --uid */
4343
const char *uname; /* --uname */
4444
const char *passphrase; /* --passphrase */
45-
char mode; /* Program mode: 'c', 't', 'r', 'u', 'x' */
45+
int mode; /* Program mode: 'c', 't', 'r', 'u', 'x' */
4646
char symlink_mode; /* H or L, per BSD conventions */
4747
const char *option_options; /* --options */
4848
char day_first; /* show day before month in -tv output */
@@ -114,7 +114,7 @@ struct bsdtar {
114114

115115
/* Fake short equivalents for long options that otherwise lack them. */
116116
enum {
117-
OPTION_ACLS = 1,
117+
OPTION_ACLS = 256,
118118
OPTION_B64ENCODE,
119119
OPTION_CHECK_LINKS,
120120
OPTION_CHROOT,

0 commit comments

Comments
 (0)