Widened the lseek capacity determination to SEEK_SET with wanted size
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include "sort_cmp.h"
|
||||
#include "parse_exec.h"
|
||||
#include "write_run.h"
|
||||
|
||||
#include "disk_ops.h"
|
||||
|
||||
|
||||
/* @param flag bit0= give directory x-permission where is r-permission
|
||||
@@ -1225,27 +1225,6 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_lseek_capacity(struct XorrisO *xorriso, char *path,
|
||||
off_t *capacity, int flag)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd= open(path, O_RDONLY);
|
||||
if(fd < 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Determination of random-access readable capacity failed: ");
|
||||
Text_shellsafe(path, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
|
||||
return -1;
|
||||
}
|
||||
*capacity= lseek(fd, 0, SEEK_END);
|
||||
close(fd);
|
||||
if(*capacity < 0)
|
||||
return(-1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= -follow: disk_path is not a command parameter
|
||||
*/
|
||||
int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path,
|
||||
@@ -1292,7 +1271,8 @@ int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path,
|
||||
src_size= stbuf.st_size;
|
||||
} else if(!(S_ISDIR(stbuf.st_mode) || S_ISLNK(stbuf.st_mode) ||
|
||||
S_ISFIFO(stbuf.st_mode) || S_ISSOCK(stbuf.st_mode))) {
|
||||
ret= Xorriso_lseek_capacity(xorriso, eff_source, &src_size, 0);
|
||||
src_size= startbyte + bytecount;
|
||||
ret= Xorriso_determine_capacity(xorriso, eff_source, &src_size, NULL, 1);
|
||||
if(ret <= 0)
|
||||
goto unsupported_type;
|
||||
if(src_size <= 0) {
|
||||
@@ -1311,7 +1291,7 @@ unsupported_type:;
|
||||
Ftypetxt(stbuf.st_mode, 0));
|
||||
} else {
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out: File (%s) does not support random read access: ",
|
||||
"-cut_out: File (%s) does not support or permit random read access: ",
|
||||
Ftypetxt(stbuf.st_mode, 0));
|
||||
}
|
||||
Text_shellsafe(eff_source, xorriso->info_text, 1);
|
||||
|
Reference in New Issue
Block a user