Browse code

sigtool/sigtool.c: fix formatting of hash dbs (bb#2765)

Tomasz Kojm authored on 2011/05/04 08:16:53
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue May  3 16:14:27 PDT 2011 (tk)
2
+---------------------------------
3
+ * sigtool/sigtool.c: fix formatting of hash dbs (bb#2765)
4
+
1 5
 Wed Apr 27 15:07:22 CEST 2011 (tk)
2 6
 ----------------------------------
3 7
  * freshclam: add mirror statistics mechanism
... ...
@@ -45,6 +45,7 @@
45 45
 #endif
46 46
 #include <dirent.h>
47 47
 #include <ctype.h>
48
+#include <libgen.h>
48 49
 
49 50
 #ifdef HAVE_TERMIOS_H
50 51
 #include <termios.h>
... ...
@@ -170,9 +171,9 @@ static int hashsig(const struct optstruct *opts, unsigned int mdb, int type)
170 170
 		if((sb.st_mode & S_IFMT) == S_IFREG) {
171 171
 		    if((hash = cli_hashfile(opts->filename[i], type))) {
172 172
 			if(mdb)
173
-			    mprintf("%u:%s:%s\n", (unsigned int) sb.st_size, hash, opts->filename[i]);
173
+			    mprintf("%u:%s:%s\n", (unsigned int) sb.st_size, hash, basename(opts->filename[i]));
174 174
 			else
175
-			    mprintf("%s:%u:%s\n", hash, (unsigned int) sb.st_size, opts->filename[i]);
175
+			    mprintf("%s:%u:%s\n", hash, (unsigned int) sb.st_size, basename(opts->filename[i]));
176 176
 			free(hash);
177 177
 		    } else {
178 178
 			mprintf("!hashsig: Can't generate hash for %s\n", opts->filename[i]);