|
|
a4d85a |
diff --git a/lib/rmt.h b/lib/rmt.h
|
|
|
a4d85a |
index 2ce9dc5..4580e49 100644
|
|
|
a4d85a |
--- a/lib/rmt.h
|
|
|
a4d85a |
+++ b/lib/rmt.h
|
|
|
a4d85a |
@@ -17,8 +17,9 @@
|
|
|
a4d85a |
along with this program; if not, write to the Free Software Foundation,
|
|
|
a4d85a |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
|
a4d85a |
|
|
|
a4d85a |
-extern char *rmt_command;
|
|
|
a4d85a |
-extern char *rmt_dev_name__;
|
|
|
a4d85a |
+/* upstream fix 0b3d84a0ee */
|
|
|
a4d85a |
+extern char const *rmt_command;
|
|
|
a4d85a |
+extern char const *rmt_dev_name__;
|
|
|
a4d85a |
|
|
|
a4d85a |
int rmt_open__ (const char *, int, int, const char *);
|
|
|
a4d85a |
int rmt_close__ (int);
|
|
|
a4d85a |
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
|
|
|
a4d85a |
index 3aee428..1cef0fc 100644
|
|
|
a4d85a |
--- a/lib/rtapelib.c
|
|
|
a4d85a |
+++ b/lib/rtapelib.c
|
|
|
a4d85a |
@@ -90,10 +90,10 @@ static int from_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
|
|
|
a4d85a |
/* The pipes for sending data to remote tape drives. */
|
|
|
a4d85a |
static int to_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
|
|
|
a4d85a |
|
|
|
a4d85a |
-char *rmt_command = DEFAULT_RMT_COMMAND;
|
|
|
a4d85a |
+char const *rmt_command = DEFAULT_RMT_COMMAND; /* upstream fix 0b3d84a0ee */
|
|
|
a4d85a |
|
|
|
a4d85a |
/* Temporary variable used by macros in rmt.h. */
|
|
|
a4d85a |
-char *rmt_dev_name__;
|
|
|
a4d85a |
+char const *rmt_dev_name__; /* upstream fix 0b3d84a0ee */
|
|
|
a4d85a |
|
|
|
a4d85a |
/* If true, always consider file names to be local, even if they contain
|
|
|
a4d85a |
colons */
|
|
|
a4d85a |
@@ -490,15 +490,17 @@ rmt_open__ (const char *file_name, int open_mode, int bias,
|
|
|
a4d85a |
{
|
|
|
a4d85a |
/* Child. */
|
|
|
a4d85a |
|
|
|
a4d85a |
- close (STDIN_FILENO);
|
|
|
a4d85a |
- dup (to_remote[remote_pipe_number][PREAD]);
|
|
|
a4d85a |
- close (to_remote[remote_pipe_number][PREAD]);
|
|
|
a4d85a |
- close (to_remote[remote_pipe_number][PWRITE]);
|
|
|
a4d85a |
-
|
|
|
a4d85a |
- close (STDOUT_FILENO);
|
|
|
a4d85a |
- dup (from_remote[remote_pipe_number][PWRITE]);
|
|
|
a4d85a |
- close (from_remote[remote_pipe_number][PREAD]);
|
|
|
a4d85a |
- close (from_remote[remote_pipe_number][PWRITE]);
|
|
|
a4d85a |
+ /* upstream fix 0b3d84a0ee */
|
|
|
a4d85a |
+ if (dup2 (to_remote[remote_pipe_number][PREAD], STDIN_FILENO) < 0
|
|
|
a4d85a |
+ || (to_remote[remote_pipe_number][PREAD] != STDIN_FILENO
|
|
|
a4d85a |
+ && close (to_remote[remote_pipe_number][PREAD]) != 0)
|
|
|
a4d85a |
+ || (to_remote[remote_pipe_number][PWRITE] != STDIN_FILENO
|
|
|
a4d85a |
+ && close (to_remote[remote_pipe_number][PWRITE]) != 0)
|
|
|
a4d85a |
+ || dup2 (from_remote[remote_pipe_number][PWRITE], STDOUT_FILENO) < 0
|
|
|
a4d85a |
+ || close (from_remote[remote_pipe_number][PREAD]) != 0
|
|
|
a4d85a |
+ || close (from_remote[remote_pipe_number][PWRITE]) != 0)
|
|
|
a4d85a |
+ error (EXIT_ON_EXEC_ERROR, errno,
|
|
|
a4d85a |
+ _("Cannot redirect files for remote shell"));
|
|
|
a4d85a |
|
|
|
a4d85a |
sys_reset_uid_gid ();
|
|
|
a4d85a |
|
|
|
a4d85a |
diff --git a/lib/system.h b/lib/system.h
|
|
|
a4d85a |
index 2deb585..599d4ba 100644
|
|
|
a4d85a |
--- a/lib/system.h
|
|
|
a4d85a |
+++ b/lib/system.h
|
|
|
a4d85a |
@@ -471,8 +471,13 @@ char *getenv ();
|
|
|
a4d85a |
# define SET_BINARY_MODE(arc)
|
|
|
a4d85a |
# define ERRNO_IS_EACCES 0
|
|
|
a4d85a |
# define TTY_NAME "/dev/tty"
|
|
|
a4d85a |
-# define sys_reset_uid_gid() \
|
|
|
a4d85a |
- do { setuid (getuid ()); setgid (getgid ()); } while (0)
|
|
|
a4d85a |
+
|
|
|
a4d85a |
+/* upstream fix 0b3d84a0ee */
|
|
|
a4d85a |
+# define sys_reset_uid_gid() \
|
|
|
a4d85a |
+ do { \
|
|
|
a4d85a |
+ if (! (setuid (getuid ()) == 0 && setgid (getgid ()) == 0)) \
|
|
|
a4d85a |
+ abort (); \
|
|
|
a4d85a |
+ } while (0)
|
|
|
a4d85a |
#endif
|
|
|
a4d85a |
|
|
|
a4d85a |
#if XENIX
|
|
|
a4d85a |
diff --git a/src/compare.c b/src/compare.c
|
|
|
a4d85a |
index 273269a..796d7aa 100644
|
|
|
a4d85a |
--- a/src/compare.c
|
|
|
a4d85a |
+++ b/src/compare.c
|
|
|
a4d85a |
@@ -362,7 +362,7 @@ static void
|
|
|
a4d85a |
diff_dumpdir (void)
|
|
|
a4d85a |
{
|
|
|
a4d85a |
const char *dumpdir_buffer;
|
|
|
a4d85a |
- dev_t dev = 0;
|
|
|
a4d85a |
+ /* upstream fix 5bb04335079 */
|
|
|
a4d85a |
struct stat stat_data;
|
|
|
a4d85a |
|
|
|
a4d85a |
if (deref_stat (current_stat_info.file_name, &stat_data) != 0)
|
|
|
a4d85a |
@@ -372,8 +372,7 @@ diff_dumpdir (void)
|
|
|
a4d85a |
else
|
|
|
a4d85a |
stat_error (current_stat_info.file_name);
|
|
|
a4d85a |
}
|
|
|
a4d85a |
- else
|
|
|
a4d85a |
- dev = stat_data.st_dev;
|
|
|
a4d85a |
+ /* upstream fix 5bb04335079 */
|
|
|
a4d85a |
|
|
|
a4d85a |
dumpdir_buffer = directory_contents (scan_directory (¤t_stat_info));
|
|
|
a4d85a |
|
|
|
a4d85a |
diff --git a/src/update.c b/src/update.c
|
|
|
a4d85a |
index 4739e0d..3b28734 100644
|
|
|
a4d85a |
--- a/src/update.c
|
|
|
a4d85a |
+++ b/src/update.c
|
|
|
a4d85a |
@@ -145,7 +145,7 @@ update_archive (void)
|
|
|
a4d85a |
if (S_ISDIR (s.st_mode))
|
|
|
a4d85a |
{
|
|
|
a4d85a |
char *p, *dirp;
|
|
|
a4d85a |
- DIR *stream;
|
|
|
a4d85a |
+ DIR *stream = NULL; /* upstream commit 5bb043350790 */
|
|
|
a4d85a |
int fd = openat (chdir_fd, name->name,
|
|
|
a4d85a |
open_read_flags | O_DIRECTORY);
|
|
|
a4d85a |
if (fd < 0)
|
|
|
a4d85a |
diff --git a/tests/genfile.c b/tests/genfile.c
|
|
|
a4d85a |
index 8541be6..fa480ef 100644
|
|
|
a4d85a |
--- a/tests/genfile.c
|
|
|
a4d85a |
+++ b/tests/genfile.c
|
|
|
a4d85a |
@@ -485,9 +485,11 @@ generate_files_from_list ()
|
|
|
a4d85a |
static void
|
|
|
a4d85a |
mkhole (int fd, off_t displ)
|
|
|
a4d85a |
{
|
|
|
a4d85a |
- if (lseek (fd, displ, SEEK_CUR) == -1)
|
|
|
a4d85a |
+ off_t offset = lseek (fd, displ, SEEK_CUR);
|
|
|
a4d85a |
+ if (offset < 0)
|
|
|
a4d85a |
error (EXIT_FAILURE, errno, "lseek");
|
|
|
a4d85a |
- ftruncate (fd, lseek (fd, 0, SEEK_CUR));
|
|
|
a4d85a |
+ if (ftruncate (fd, offset) != 0)
|
|
|
a4d85a |
+ error (EXIT_FAILURE, errno, "ftruncate");
|
|
|
a4d85a |
}
|
|
|
a4d85a |
|
|
|
a4d85a |
static void
|
|
|
a4d85a |
@@ -685,13 +687,18 @@ exec_checkpoint (struct action *p)
|
|
|
a4d85a |
error (0, errno, _("cannot open `%s'"), p->name);
|
|
|
a4d85a |
break;
|
|
|
a4d85a |
}
|
|
|
a4d85a |
- ftruncate (fd, p->size);
|
|
|
a4d85a |
+ if (ftruncate (fd, p->size) != 0)
|
|
|
a4d85a |
+ {
|
|
|
a4d85a |
+ error (0, errno, _("cannot truncate `%s'"), p->name);
|
|
|
a4d85a |
+ break;
|
|
|
a4d85a |
+ }
|
|
|
a4d85a |
close (fd);
|
|
|
a4d85a |
}
|
|
|
a4d85a |
break;
|
|
|
a4d85a |
|
|
|
a4d85a |
case OPT_EXEC:
|
|
|
a4d85a |
- system (p->name);
|
|
|
a4d85a |
+ if (system (p->name) != 0)
|
|
|
a4d85a |
+ error (0, 0, _("command failed: %s"), p->name);
|
|
|
a4d85a |
break;
|
|
|
a4d85a |
|
|
|
a4d85a |
case OPT_UNLINK:
|
|
|
a4d85a |
@@ -761,7 +768,8 @@ exec_command (void)
|
|
|
a4d85a |
signal (SIGCHLD, SIG_DFL);
|
|
|
a4d85a |
#endif
|
|
|
a4d85a |
|
|
|
a4d85a |
- pipe (fd);
|
|
|
a4d85a |
+ if (pipe (fd) != 0)
|
|
|
a4d85a |
+ error (EXIT_FAILURE, errno, "pipe");
|
|
|
a4d85a |
|
|
|
a4d85a |
pid = fork ();
|
|
|
a4d85a |
if (pid == -1)
|