A first pass at making D_FILE_OFFSET_BITS=64 work, from
Jari Ruusu <jari.ruusu@pp.inet.fi>
This commit is contained in:
parent
c270ec1fa2
commit
83f173b61e
6
ar.c
6
ar.c
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
typedef struct ar_headers_s {
|
typedef struct ar_headers_s {
|
||||||
char *name;
|
char *name;
|
||||||
size_t size;
|
off_t size;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
@ -90,7 +90,7 @@ extern ar_headers_t get_ar_headers(int srcFd)
|
|||||||
/* dont worry about adding the last '\n', we dont need it now */
|
/* dont worry about adding the last '\n', we dont need it now */
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->size = (size_t) atoi(raw_ar_header.size);
|
entry->size = (off_t) atoi(raw_ar_header.size);
|
||||||
/* long filenames have '/' as the first character */
|
/* long filenames have '/' as the first character */
|
||||||
if (raw_ar_header.name[0] == '/') {
|
if (raw_ar_header.name[0] == '/') {
|
||||||
if (raw_ar_header.name[1] == '/') {
|
if (raw_ar_header.name[1] == '/') {
|
||||||
@ -211,7 +211,7 @@ extern int ar_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||||
lseek(srcFd, extract_list->offset, SEEK_SET);
|
lseek(srcFd, extract_list->offset, SEEK_SET);
|
||||||
copy_file_chunk(srcFd, dstFd, (size_t) extract_list->size);
|
copy_file_chunk(srcFd, dstFd, (off_t) extract_list->size);
|
||||||
}
|
}
|
||||||
if (funct & verbose) {
|
if (funct & verbose) {
|
||||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
typedef struct ar_headers_s {
|
typedef struct ar_headers_s {
|
||||||
char *name;
|
char *name;
|
||||||
size_t size;
|
off_t size;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
@ -90,7 +90,7 @@ extern ar_headers_t get_ar_headers(int srcFd)
|
|||||||
/* dont worry about adding the last '\n', we dont need it now */
|
/* dont worry about adding the last '\n', we dont need it now */
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->size = (size_t) atoi(raw_ar_header.size);
|
entry->size = (off_t) atoi(raw_ar_header.size);
|
||||||
/* long filenames have '/' as the first character */
|
/* long filenames have '/' as the first character */
|
||||||
if (raw_ar_header.name[0] == '/') {
|
if (raw_ar_header.name[0] == '/') {
|
||||||
if (raw_ar_header.name[1] == '/') {
|
if (raw_ar_header.name[1] == '/') {
|
||||||
@ -211,7 +211,7 @@ extern int ar_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||||
lseek(srcFd, extract_list->offset, SEEK_SET);
|
lseek(srcFd, extract_list->offset, SEEK_SET);
|
||||||
copy_file_chunk(srcFd, dstFd, (size_t) extract_list->size);
|
copy_file_chunk(srcFd, dstFd, (off_t) extract_list->size);
|
||||||
}
|
}
|
||||||
if (funct & verbose) {
|
if (funct & verbose) {
|
||||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copy chunksize bytes between two file descriptors
|
* Copy chunksize bytes between two file descriptors
|
||||||
*/
|
*/
|
||||||
int copy_file_chunk(int srcfd, int dstfd, size_t chunksize)
|
int copy_file_chunk(int srcfd, int dstfd, off_t chunksize)
|
||||||
{
|
{
|
||||||
size_t size;
|
off_t size;
|
||||||
char buffer[BUFSIZ]; /* BUFSIZ is declared in stdio.h */
|
char buffer[BUFSIZ]; /* BUFSIZ is declared in stdio.h */
|
||||||
|
|
||||||
while (chunksize > 0) {
|
while (chunksize > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user