Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/testpkg.c8
-rw-r--r--src/util/vercmp.c23
3 files changed, 14 insertions, 19 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 0c48f10e..d5783612 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -2,7 +2,7 @@ bin_PROGRAMS = vercmp testpkg
INCLUDES = -I$(top_srcdir)/lib/libalpm
-AM_CFLAGS = -pedantic
+AM_CFLAGS = -pedantic -D_GNU_SOURCE
vercmp_SOURCES = vercmp.c
vercmp_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 1ad1d14b..53ae8322 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -21,11 +21,9 @@
#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <libgen.h>
+#include <stdio.h> /* printf */
+#include <stdarg.h> /* va_list */
+#include <string.h> /* strlen */
#include <alpm.h>
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index cc951988..873ef1c9 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -21,29 +21,26 @@
#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
-/* TODO this is probably not the best way to do this */
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
+#include <stdio.h> /* printf */
+#include <string.h> /* strncpy */
#include <alpm.h>
+#define MAX_LEN 255
+
int main(int argc, char *argv[])
{
- char s1[255] = "";
- char s2[255] = "";
+ char s1[MAX_LEN] = "";
+ char s2[MAX_LEN] = "";
int ret;
if(argc > 1) {
- strncpy(s1, argv[1], 255);
+ strncpy(s1, argv[1], MAX_LEN);
+ s1[MAX_LEN -1] = '\0';
}
if(argc > 2) {
- strncpy(s2, argv[2], 255);
+ strncpy(s2, argv[2], MAX_LEN);
+ s2[MAX_LEN -1] = '\0';
} else {
printf("0\n");
return(0);