sigtool: fix --verify-cdiff

remotes/push_mirror/vc9-vt-dnd
Tomasz Kojm 15 years ago
parent 467ab203c6
commit 105950c49e
  1. 4
      ChangeLog
  2. 24
      sigtool/sigtool.c

@ -1,3 +1,7 @@
Wed Mar 16 15:53:42 CET 2011 (tk)
---------------------------------
* sigtool: fix --verify-cdiff
Tue Mar 15 17:56:59 CET 2011 (tk)
---------------------------------
* sigtool: allow arbitrary names for --build

@ -44,6 +44,7 @@
#include <sys/wait.h>
#endif
#include <dirent.h>
#include <ctype.h>
#ifdef HAVE_TERMIOS_H
#include <termios.h>
@ -1475,15 +1476,31 @@ static int vbadump(const struct optstruct *opts)
return 0;
}
static int comparesha(const char *dbname)
static int comparesha(const char *diff)
{
char info[32], buff[FILEBUFF], *sha;
char info[32], buff[FILEBUFF], *sha, *pt, *name;
const char *tokens[3];
FILE *fh;
int ret = 0, tokens_count;
name = strdup(diff);
if(!name) {
mprintf("!verifydiff: strdup() failed\n");
return -1;
}
if(!(pt = strrchr(name, '-')) || !isdigit(pt[1])) {
mprintf("!verifydiff: Invalid diff name\n");
free(name);
return -1;
}
*pt = 0;
if((pt = strrchr(name, *PATHSEP)))
pt++;
else
pt = name;
snprintf(info, sizeof(info), "%s.info", getdbname(dbname, buff, 32));
snprintf(info, sizeof(info), "%s.info", pt);
free(name);
if(!(fh = fopen(info, "rb"))) {
mprintf("!verifydiff: Can't open %s\n", info);
@ -1524,7 +1541,6 @@ static int comparesha(const char *dbname)
return ret;
}
static int rundiff(const struct optstruct *opts)
{
int fd, ret;

Loading…
Cancel
Save