fixed
This commit is contained in:
parent
6b6884ddfa
commit
f9616dddda
13
img.c
13
img.c
@ -83,7 +83,6 @@ void add(char **list, const int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
snprintf(new_path, sizeof(new_path), "%s/%s", ROOT, name);
|
snprintf(new_path, sizeof(new_path), "%s/%s", ROOT, name);
|
||||||
free(name);
|
|
||||||
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (stat(new_path, &sb) < 0)
|
if (stat(new_path, &sb) < 0)
|
||||||
@ -95,8 +94,10 @@ void add(char **list, const int size) {
|
|||||||
|
|
||||||
/* Update db */
|
/* Update db */
|
||||||
FILE *fp = file_open(DB, "a");
|
FILE *fp = file_open(DB, "a");
|
||||||
if (fp == NULL)
|
if (fp == NULL) {
|
||||||
|
free(name);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Write filename ,tag1,tag2... to the db */
|
/* Write filename ,tag1,tag2... to the db */
|
||||||
fprintf(fp, "%s ", name);
|
fprintf(fp, "%s ", name);
|
||||||
@ -109,6 +110,7 @@ void add(char **list, const int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
|
free(name);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +441,7 @@ void rebuild(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void help(void) {
|
void help(void) {
|
||||||
puts("8img [add/rebuild]:\n\tadd [img] [tag1] [tag2] [...]\n\trebuild");
|
puts("8img [add/rebuild]:\n\tadd [img] [tag1] [tag2] [...]\n\trebuild\n\tversion");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,6 +462,11 @@ int main(int argc, char **argv) {
|
|||||||
else if (!strcmp(argv[0], "rebuild"))
|
else if (!strcmp(argv[0], "rebuild"))
|
||||||
rebuild();
|
rebuild();
|
||||||
|
|
||||||
|
else if (!strcmp(argv[0], "rebuild"))
|
||||||
|
puts("8img version: 1.0\nWritten under WTFPL License.");
|
||||||
|
|
||||||
else
|
else
|
||||||
help();
|
help();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user