commit a01df0606fd6d2f7675a6c170c8e6e5acdb026d6
parent ccfdce0900819580b2f6b0941015ac2fbdc71809
Author: Naveen Narayanan zerous <zerous@nocebo.space>
Date: Sat, 23 Dec 2017 16:32:38 +0300
fix debug log. (-d)
Diffstat:
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/log.c b/log.c
@@ -30,14 +30,12 @@ vlog(char *msg, va_list ap)
if (!stat(file,&sb))
remove(file);
- else {
- if((fp = fopen(file, "ab"))) {
- fprintf(fp, "%s: ", progname);
- vfprintf(fp, msg, ap);
- fputc('\n', fp);
- } else {
- fprintf(stderr, "fopen %s: %s", file, strerror(errno));
- }
+ if((fp = fopen(file, "ab"))) {
+ fprintf(fp, "%s: ", progname);
+ vfprintf(fp, msg, ap);
+ fputc('\n', fp);
+ } else {
+ fprintf(stderr, "fopen %s: %s", file, strerror(errno));
}
} else {
fprintf(stderr, "%s: ", progname);
diff --git a/pass.c b/pass.c
@@ -346,13 +346,16 @@ main(int argc, char** argv)
{
debug = 0;
- for (char *s = *argv, i = 0; i < argc; i++) {
- if (!strcmp("-d", s))
+ char **s;
+ int i;
+
+ for (s = argv, i = 0; i < argc; i++) {
+ if (!strcmp("-d", *s++))
debug = 1;
- s++;
}
- if (debug)
- loginit("pass");
+
+ loginit("pass");
+
if (argc > 1)
{
argv++;