aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk2
-rw-r--r--libcontacts_format_contact.c2
-rw-r--r--libcontacts_load_contact.c3
3 files changed, 4 insertions, 3 deletions
diff --git a/config.mk b/config.mk
index 9404b9a..aa81003 100644
--- a/config.mk
+++ b/config.mk
@@ -4,5 +4,5 @@ MANPREFIX = $(PREFIX)/share/man
CC = cc
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
-CFLAGS = -std=c99 -O2
+CFLAGS = -std=c99 -Wall -O2
LDFLAGS = -s
diff --git a/libcontacts_format_contact.c b/libcontacts_format_contact.c
index 8be830e..9a20fcf 100644
--- a/libcontacts_format_contact.c
+++ b/libcontacts_format_contact.c
@@ -191,7 +191,7 @@ libcontacts_format_contact(const struct libcontacts_contact *contact, char **dat
} else if (contact->birthday->year) {
fprintf(fp, "BIRTH %04i\n", contact->birthday->year);
} else if (contact->birthday->day) {
- fprintf(fp, "BIRTH %02i-%02\n", contact->birthday->month, contact->birthday->day);
+ fprintf(fp, "BIRTH %02i-%02i\n", contact->birthday->month, contact->birthday->day);
} else if (contact->birthday->month) {
fprintf(fp, "BIRTH %02i\n", contact->birthday->month);
}
diff --git a/libcontacts_load_contact.c b/libcontacts_load_contact.c
index 2d6f933..0821871 100644
--- a/libcontacts_load_contact.c
+++ b/libcontacts_load_contact.c
@@ -30,6 +30,7 @@ libcontacts_load_contact(const char *id, struct libcontacts_contact *contact, co
if (!new)
goto fail;
n += 8 << 10;
+ data = new;
}
r = read(fd, &data[p], n - p);
if (r <= 0) {
@@ -41,7 +42,7 @@ libcontacts_load_contact(const char *id, struct libcontacts_contact *contact, co
}
data[p] = '\0';
- if (memchr(data, 0, p)) {
+ if (memchr(data, '\0', p)) {
errno = 0;
goto fail;
}