mirror of
https://github.com/sheumann/hush.git
synced 2024-09-13 06:54:44 +00:00
Fixed the comments to match the code and renamed the function to a (hopefully)
more descriptive name, and as per the style guide.
This commit is contained in:
parent
cf61fe14ae
commit
4758368505
4
ar.c
4
ar.c
@ -372,11 +372,11 @@ extern int ar_main(int argc, char **argv)
|
|||||||
createPath(extractList->name, 0666);
|
createPath(extractList->name, 0666);
|
||||||
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
|
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
|
||||||
lseek(srcFd, extractList->offset, SEEK_SET);
|
lseek(srcFd, extractList->offset, SEEK_SET);
|
||||||
copySubFile(srcFd, dstFd, (size_t) extractList->size);
|
copy_file_chunk(srcFd, dstFd, (size_t) extractList->size);
|
||||||
}
|
}
|
||||||
if (funct & EXT_TO_STDOUT) {
|
if (funct & EXT_TO_STDOUT) {
|
||||||
lseek(srcFd, extractList->offset, SEEK_SET);
|
lseek(srcFd, extractList->offset, SEEK_SET);
|
||||||
copySubFile(srcFd, fileno(stdout), (size_t) extractList->size);
|
copy_file_chunk(srcFd, fileno(stdout), (size_t) extractList->size);
|
||||||
}
|
}
|
||||||
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
|
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
|
||||||
if (funct & VERBOSE)
|
if (funct & VERBOSE)
|
||||||
|
@ -372,11 +372,11 @@ extern int ar_main(int argc, char **argv)
|
|||||||
createPath(extractList->name, 0666);
|
createPath(extractList->name, 0666);
|
||||||
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
|
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
|
||||||
lseek(srcFd, extractList->offset, SEEK_SET);
|
lseek(srcFd, extractList->offset, SEEK_SET);
|
||||||
copySubFile(srcFd, dstFd, (size_t) extractList->size);
|
copy_file_chunk(srcFd, dstFd, (size_t) extractList->size);
|
||||||
}
|
}
|
||||||
if (funct & EXT_TO_STDOUT) {
|
if (funct & EXT_TO_STDOUT) {
|
||||||
lseek(srcFd, extractList->offset, SEEK_SET);
|
lseek(srcFd, extractList->offset, SEEK_SET);
|
||||||
copySubFile(srcFd, fileno(stdout), (size_t) extractList->size);
|
copy_file_chunk(srcFd, fileno(stdout), (size_t) extractList->size);
|
||||||
}
|
}
|
||||||
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
|
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
|
||||||
if (funct & VERBOSE)
|
if (funct & VERBOSE)
|
||||||
|
@ -144,7 +144,7 @@ void reset_ino_dev_hashtable(void);
|
|||||||
|
|
||||||
int copyFile(const char *srcName, const char *destName,
|
int copyFile(const char *srcName, const char *destName,
|
||||||
int setModes, int followLinks, int forceFlag);
|
int setModes, int followLinks, int forceFlag);
|
||||||
int copySubFile(int srcFd, int dstFd, size_t remaining);
|
int copy_file_chunk(int srcFd, int dstFd, size_t remaining);
|
||||||
char *buildName(const char *dirName, const char *fileName);
|
char *buildName(const char *dirName, const char *fileName);
|
||||||
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
||||||
char *getChunk(int size);
|
char *getChunk(int size);
|
||||||
|
@ -144,7 +144,7 @@ void reset_ino_dev_hashtable(void);
|
|||||||
|
|
||||||
int copyFile(const char *srcName, const char *destName,
|
int copyFile(const char *srcName, const char *destName,
|
||||||
int setModes, int followLinks, int forceFlag);
|
int setModes, int followLinks, int forceFlag);
|
||||||
int copySubFile(int srcFd, int dstFd, size_t remaining);
|
int copy_file_chunk(int srcFd, int dstFd, size_t remaining);
|
||||||
char *buildName(const char *dirName, const char *fileName);
|
char *buildName(const char *dirName, const char *fileName);
|
||||||
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
||||||
char *getChunk(int size);
|
char *getChunk(int size);
|
||||||
|
18
utility.c
18
utility.c
@ -296,21 +296,21 @@ int isDirectory(const char *fileName, const int followLinks, struct stat *statBu
|
|||||||
|
|
||||||
#if defined (BB_AR) || defined BB_CP_MV
|
#if defined (BB_AR) || defined BB_CP_MV
|
||||||
/*
|
/*
|
||||||
* Copy readSize bytes between two file descriptors
|
* Copy chunksize bytes between two file descriptors
|
||||||
*/
|
*/
|
||||||
int copySubFile(int srcFd, int dstFd, size_t remaining)
|
int copy_file_chunk(int srcfd, int dstfd, size_t chunksize)
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ]; /* BUFSIZ is declared in stdio.h */
|
||||||
|
|
||||||
while (remaining > 0) {
|
while (chunksize > 0) {
|
||||||
if (remaining > BUFSIZ)
|
if (chunksize > BUFSIZ)
|
||||||
size = BUFSIZ;
|
size = BUFSIZ;
|
||||||
else
|
else
|
||||||
size = remaining;
|
size = chunksize;
|
||||||
if (fullWrite(dstFd, buffer, fullRead(srcFd, buffer, size)) < size)
|
if (fullWrite(dstfd, buffer, fullRead(srcfd, buffer, size)) < size)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
remaining -= size;
|
chunksize -= size;
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ copyFile(const char *srcName, const char *destName,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copySubFile(rfd, wfd, srcStatBuf.st_size)==FALSE)
|
if (copy_file_chunk(rfd, wfd, srcStatBuf.st_size)==FALSE)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
close(rfd);
|
close(rfd);
|
||||||
|
Loading…
Reference in New Issue
Block a user