Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lz4cat and unlz4 not recognised when invoked via a path #284

Closed
beiDei8z opened this issue Dec 7, 2016 · 1 comment
Closed

lz4cat and unlz4 not recognised when invoked via a path #284

beiDei8z opened this issue Dec 7, 2016 · 1 comment
Assignees

Comments

@beiDei8z
Copy link

beiDei8z commented Dec 7, 2016

When lz4cat or unlz4 are called using a path, directory plus file name, the programme name is not matched.

Patch in report because "We don’t support that file type."

--- ../original/programs/lz4cli.c	2016-11-22 20:34:17.000000000 +0000
+++ programs/lz4cli.c	2016-12-07 16:36:35.892711640 +0000
@@ -53,6 +53,7 @@
 #include <stdio.h>    /* fprintf, getchar */
 #include <stdlib.h>   /* exit, calloc, free */
 #include <string.h>   /* strcmp, strlen */
+#include <strings.h>  /* rindex */
 #include "bench.h"    /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */
 #include "lz4io.h"    /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */
 #include "lz4hc.h"    /* LZ4HC_DEFAULT_CLEVEL */
@@ -293,7 +294,12 @@
     const char nullOutput[] = NULL_OUTPUT;
     const char extension[] = LZ4_EXTENSION;
     size_t blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT);
-    const char* const exeName = argv[0];
+    const char* exeName = argv[0];
+    const char* slash = rindex(exeName, '/');
+    if (slash != NULL) {
+        exeName = slash + 1;
+    }
+
 #ifdef UTIL_HAS_CREATEFILELIST
     const char** extendedFileList = NULL;
     char* fileNamesBuf = NULL;

@beiDei8z beiDei8z changed the title lz4cat and unlz4 not reconised when invoked via a path lz4cat and unlz4 not recognised when invoked via a path Dec 7, 2016
@Cyan4973 Cyan4973 self-assigned this Dec 7, 2016
@Cyan4973
Copy link
Member

Cyan4973 commented Dec 7, 2016

Thanks for reporting @beiDei8z .
The issue should be fixed in latest dev branch update.

@Cyan4973 Cyan4973 mentioned this issue Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants