fix various compilation errors

Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).

Fix also a warning about unsigned vs signed const char pointers in
openssl.
This commit is contained in:
Omar Polo 2021-02-12 12:47:20 +00:00
parent 3cb3dd4d42
commit 52418c8d82
12 changed files with 25 additions and 26 deletions

2
configure vendored
View File

@ -296,8 +296,6 @@ cat <<__HEREDOC__
__HEREDOC__
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
[ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \
${HAVE_RECALLOCARRAY} -eq 0 -o \
${HAVE_STRLCAT} -eq 0 -o \

4
ex.c
View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <err.h>
#include <errno.h>
@ -24,8 +26,6 @@
#include <stdarg.h>
#include <string.h>
#include "gmid.h"
int
send_string(int fd, const char *str)
{

4
gg.c
View File

@ -14,10 +14,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#include "gmid.h"
#include <string.h>
int flag2, flag3, bflag, cflag, hflag, Nflag, Vflag, vflag;
const char *cert, *key;

4
gmid.c
View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <sys/stat.h>
#include <errno.h>
@ -23,8 +25,6 @@
#include <signal.h>
#include <string.h>
#include "gmid.h"
volatile sig_atomic_t hupped;
struct vhost hosts[HOSTSLEN];

4
gmid.h
View File

@ -17,6 +17,8 @@
#ifndef GMID_H
#define GMID_H
#include "config.h"
#include <sys/socket.h>
#include <sys/types.h>
@ -33,8 +35,6 @@
#include <openssl/x509.h>
#include "config.h"
#define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */
#define SUCCESS 20

4
iri.c
View File

@ -14,11 +14,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <ctype.h>
#include <string.h>
#include "gmid.h"
static inline int
unreserved(int p)
{

4
log.c
View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <errno.h>
#include <netdb.h>
#include <stdarg.h>
@ -21,8 +23,6 @@
#include <string.h>
#include <syslog.h>
#include "gmid.h"
void
fatal(const char *fmt, ...)
{

4
mime.c
View File

@ -14,12 +14,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "gmid.h"
void
init_mime(struct mime *mime)
{

4
puny.c
View File

@ -14,12 +14,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "gmid.h"
#define BASE 36
#define TMIN 1
#define TMAX 26

View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <sys/stat.h>
#include <netdb.h>
@ -26,8 +28,6 @@
#include <limits.h>
#include <string.h>
#include "gmid.h"
struct server {
struct client clients[MAX_USERS];
struct tls *ctx;

4
utf8.c
View File

@ -21,11 +21,11 @@
* SOFTWARE.
*/
#include "gmid.h"
#include <stddef.h>
#include <stdint.h>
#include "gmid.h"
#define UTF8_ACCEPT 0
#define UTF8_REJECT 1

View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gmid.h"
#include <errno.h>
#include <string.h>
@ -22,8 +24,6 @@
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
#include "gmid.h"
static sigset_t set;
void
@ -115,7 +115,7 @@ xstrdup(const char *s)
}
void
gen_certificate(const char *host, const char *certpath, const char *keypath)
gen_certificate(const char *hostname, const char *certpath, const char *keypath)
{
BIGNUM *e;
EVP_PKEY *pkey;
@ -123,7 +123,8 @@ gen_certificate(const char *host, const char *certpath, const char *keypath)
X509 *x509;
X509_NAME *name;
FILE *f;
const char *org = "gmid";
const unsigned char *org = (const unsigned char*)"gmid";
const unsigned char *host = (const unsigned char*)hostname;
log_notice(NULL,
"generating new certificate for %s (it could take a while)",