summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-02-28 13:23:14 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-02-28 13:25:37 -0800
commitc30dcfedd3c616f706b4f5db166793de4ac1f64d (patch)
tree760715adbb65d90a59b1764fe9cc03d6c406d480
parent7c7dc5ea3a8f7fca0c2696e434938c1048f9e66d (diff)
downloadpaxutils-c30dcfedd3c616f706b4f5db166793de4ac1f64d.tar.gz
Use unsigned long int for ioctl ops
* lib/rtapelib.c (rmt_ioctl__): * paxlib/rtape.c (rmt_ioctl): Arg is now of type unsigned long int, not int. This works better on GNU/Linux, where some ioctl values used by this code do not fit in int. FreeBSD ioctl also has unsigned long int here, and old hosts where it’s int should still work when this is unsigned long int. Problem reported by clang.
-rw-r--r--lib/rmt.h2
-rw-r--r--lib/rtapelib.c3
-rw-r--r--paxlib/pax.h11
-rw-r--r--paxlib/rtape.c2
4 files changed, 8 insertions, 10 deletions
diff --git a/lib/rmt.h b/lib/rmt.h
index 721061c..45216fe 100644
--- a/lib/rmt.h
+++ b/lib/rmt.h
@@ -25,7 +25,7 @@ int rmt_close__ (int);
size_t rmt_read__ (int, char *, size_t);
size_t rmt_write__ (int, char *, size_t);
off_t rmt_lseek__ (int, off_t, int);
-int rmt_ioctl__ (int, int, void *);
+int rmt_ioctl__ (int, unsigned long int, void *);
extern bool force_local_option;
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index 0c516e5..5190cd4 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -656,7 +656,7 @@ rmt_lseek__ (int handle, off_t offset, int whence)
/* Perform a raw tape operation on remote tape connection HANDLE.
Return the results of the ioctl, or -1 on error. */
int
-rmt_ioctl__ (int handle, int operation, void *argument)
+rmt_ioctl__ (int handle, unsigned long int operation, void *argument)
{
switch (operation)
{
@@ -674,7 +674,6 @@ rmt_ioctl__ (int handle, int operation, void *argument)
/* MTIOCTOP is the easy one. Nothing is transferred in binary. */
- verify (EXPR_SIGNED (mtop->mt_count));
intmax_t count = mtop->mt_count;
sprintf (command_buffer, "I%d\n%jd\n", mtop->mt_op, count);
if (do_command (handle, command_buffer) == -1)
diff --git a/paxlib/pax.h b/paxlib/pax.h
index a9e565e..e82c119 100644
--- a/paxlib/pax.h
+++ b/paxlib/pax.h
@@ -37,17 +37,17 @@ struct tar_stat_info
unsigned long atime_nsec;
unsigned long mtime_nsec;
unsigned long ctime_nsec;
-
+
off_t archive_file_size; /* Size of file as stored in the archive.
Equals stat.st_size for non-sparse files */
- bool is_sparse; /* Is the file sparse */
-
+ bool is_sparse; /* Is the file sparse */
+
size_t sparse_map_avail; /* Index to the first unused element in
sparse_map array. Zero if the file is
not sparse */
size_t sparse_map_size; /* Size of the sparse map */
- struct sp_array *sparse_map;
+ struct sp_array *sparse_map;
};
@@ -58,7 +58,7 @@ int rmt_close (int handle);
size_t rmt_read (int handle, char *buffer, size_t length);
size_t rmt_write (int handle, char *buffer, size_t length);
off_t rmt_lseek (int handle, off_t offset, int whence);
-int rmt_ioctl (int handle, int operation, char *argument);
+int rmt_ioctl (int handle, unsigned long int operation, char *argument);
/* Tar-specific functions */
@@ -66,4 +66,3 @@ void tar_archive_create (paxbuf_t *pbuf, const char *filename,
int remote, int mode, size_t bfactor);
void tar_set_rmt (paxbuf_t pbuf, const char *rmt);
void tar_set_rsh (paxbuf_t pbuf, const char *rsh);
-
diff --git a/paxlib/rtape.c b/paxlib/rtape.c
index 0a31c44..2364594 100644
--- a/paxlib/rtape.c
+++ b/paxlib/rtape.c
@@ -676,7 +676,7 @@ rmt_lseek (int handle, off_t offset, int whence)
/* Perform a raw tape operation on remote tape connection HANDLE.
Return the results of the ioctl, or -1 on error. */
int
-rmt_ioctl (int handle, int operation, char *argument)
+rmt_ioctl (int handle, unsigned long int operation, char *argument)
{
switch (operation)
{