Don't add files with empty filename. Also better message for multiple input files. (#994)

This commit is contained in:
Saurabh Shrivastava 2018-12-19 01:46:04 +05:30 committed by Carlos Fernandez Sanz
parent 74eefaeea7
commit 9c20e0afb1
4 changed files with 6 additions and 3 deletions

View File

@ -123,7 +123,7 @@ int api_start(struct ccx_s_options api_options)
switch (ctx->total_inputsize)
{
case -1*ENOENT:
fatal(EXIT_NO_INPUT_FILES, "Failed to open input file: File does not exist.");
fatal(EXIT_NO_INPUT_FILES, "Failed to open one of the input file(s): File does not exist.");
case -1*EACCES:
fatal(EXIT_READ_ERROR, "Failed to open input file: Unable to access");
case -1*EINVAL:

View File

@ -24,7 +24,7 @@ LLONG get_file_size (int in)
return length;
}
LLONG get_total_file_size (struct lib_ccx_ctx *ctx) // -1 if one or more files failed to open
LLONG get_total_file_size (struct lib_ccx_ctx *ctx) // -1 if one of the file(s) failed to open
{
LLONG ts=0;
int h;

View File

@ -114,6 +114,8 @@ int parsedelay (struct ccx_s_options *opt, char *par)
int append_file_to_queue (struct ccx_s_options *opt,char *filename)
{
if(filename[0] == '\0') //skip files with empty file name (ex : ./ccextractor "")
return 0;
char *c=(char *) malloc (strlen (filename)+1);
if (c==NULL)
return -1;

View File

@ -11,8 +11,9 @@ void params_dump(struct lib_ccx_ctx *ctx)
switch (ccx_options.input_source)
{
case CCX_DS_FILE:
dbg_print(CCX_DMT_VERBOSE, "Files (%d): ", ctx->num_input_files);
for (int i=0;i<ctx->num_input_files;i++)
mprint ("%s%s",ctx->inputfile[i],i==(ctx->num_input_files-1)?"":",");
mprint ("%s%s",ctx->inputfile[i],i==(ctx->num_input_files-1)?"":", ");
break;
case CCX_DS_STDIN:
mprint ("stdin");