Added a configure script to emulate GNU autoconf and related changes.

Changes included in this set:

 * Added strlcat() and strlcpy() from OpenBSD, always use them if the
   system does not have them built in.
 * Changed an array of PATH_MAX size allocated in the stack, to a dynamically
   allocated buffer from heap. This should reduce memory usage a bit.
 * Simplify code that implemented a homegrown realpath(3) implementation,
   simply use realpath(3).
 * If compiler supports -fstack-protector, build all code with
   -D_FORTIFY_SOURCE=2 and --param ssp-buffer-size=1 so that all
   buffers are protected.
This commit is contained in:
Juan RP
2010-05-19 22:38:27 +02:00
parent c13d3c96df
commit f888b582f9
22 changed files with 612 additions and 120 deletions

View File

@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2009 Juan Romero Pardines.
* Copyright (c) 2008-2010 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
#include <xbps_api.h>
#include "sha256.h"
#include "config.h"
/**
* @file lib/util.c
@@ -242,10 +243,11 @@ xbps_get_pkg_name(const char *pkg)
return NULL;
len = strlen(pkg) - strlen(tmp) + 1;
pkgname = malloc(len);
strncpy(pkgname, pkg, len);
pkgname[len - 1] = '\0';
if (pkgname == NULL)
return NULL;
strlcpy(pkgname, pkg, len);
return pkgname;
}
@@ -267,8 +269,7 @@ xbps_get_pkgpattern_name(const char *pkg)
if (pkgname == NULL)
return NULL;
strncpy(pkgname, pkg, len);
pkgname[len - 1] = '\0';
strlcpy(pkgname, pkg, len);
return pkgname;
}