Permalink
Browse files

Don't add files with empty filename. Also better message for multiple…

… input files. (#994)
  • Loading branch information...
saurabhshri authored and cfsmp3 committed Dec 18, 2018
1 parent 74eefae commit 9c20e0afb15a1dc35e0bcfb14819e62e6744fcf1
Showing with 6 additions and 3 deletions.
  1. +1 −1 src/ccextractor.c
  2. +1 −1 src/lib_ccx/file_functions.c
  3. +2 −0 src/lib_ccx/params.c
  4. +2 −1 src/lib_ccx/params_dump.c
@@ -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:
@@ -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;
@@ -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;
@@ -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");

0 comments on commit 9c20e0a

Please sign in to comment.