X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Frtapelib.c;h=cd00fd56605ae3e164f6a77db6dc49036e331e4d;hb=a5bafe7962470f7d888d34b899ec6ff50855d050;hp=34f8662955b0afbe21bf56bc780c82eeebe57e54;hpb=257a4160e4490f7299f1f0f02b6c7c024d52c970;p=chaz%2Ftar diff --git a/src/rtapelib.c b/src/rtapelib.c index 34f8662..cd00fd5 100644 --- a/src/rtapelib.c +++ b/src/rtapelib.c @@ -1,5 +1,7 @@ /* Functions for communicating with a remote tape drive. - Copyright 1988, 92, 94, 96, 97, 99, 2000 Free Software Foundation, Inc. + + Copyright 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001 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 @@ -31,8 +33,9 @@ code, courtesy of Dan Kegel. */ #include "system.h" - +#include "common.h" #include +#include /* Try hard to get EOPNOTSUPP defined. 486/ISC has it in net/errno.h, 3B2/SVR3 has it in sys/inet.h. Otherwise, like on MSDOS, use EINVAL. */ @@ -57,8 +60,6 @@ #include "rmt.h" -char *base_name PARAMS ((char const *)); - /* Exit status if exec errors. */ #define EXIT_ON_EXEC_ERROR 128 @@ -250,8 +251,6 @@ get_status_off (int handle) #if WITH_REXEC -int rexec (); - /* Execute /etc/rmt as user USER on remote system HOST using rexec. Return a file descriptor of a bidirectional socket for stdin and stdout. If USER is zero, use the current username. @@ -483,10 +482,7 @@ rmt_open__ (const char *path, int open_mode, int bias, const char *remote_shell) close (from_remote[remote_pipe_number][PREAD]); close (from_remote[remote_pipe_number][PWRITE]); -#if !MSDOS - setuid (getuid ()); - setgid (getgid ()); -#endif + sys_reset_uid_gid (); if (remote_user) execl (remote_shell, remote_shell_basename, remote_host, @@ -609,6 +605,7 @@ rmt_lseek__ (int handle, off_t offset, int whence) uintmax_t u = offset < 0 ? - (uintmax_t) offset : (uintmax_t) offset; char *p = operand_buffer + sizeof operand_buffer; + *--p = 0; do *--p = '0' + (int) (u % 10); while ((u /= 10) != 0); @@ -652,6 +649,7 @@ rmt_ioctl__ (int handle, int operation, char *argument) : (uintmax_t) ((struct mtop *) argument)->mt_count); char *p = operand_buffer + sizeof operand_buffer; + *--p = 0; do *--p = '0' + (int) (u % 10); while ((u /= 10) != 0);