aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-12 12:47:20 +0000
committerOmar Polo <op@omarpolo.com>2021-02-12 12:47:20 +0000
commit52418c8d828bc25e0e84cc25d5e349a84be0b397 (patch)
tree480166acacfecd667dcd69e68df8f6a305792277
parent3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8 (diff)
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.
-rwxr-xr-xconfigure2
-rw-r--r--ex.c4
-rw-r--r--gg.c4
-rw-r--r--gmid.c4
-rw-r--r--gmid.h4
-rw-r--r--iri.c4
-rw-r--r--log.c4
-rw-r--r--mime.c4
-rw-r--r--puny.c4
-rw-r--r--server.c4
-rw-r--r--utf8.c4
-rw-r--r--utils.c9
12 files changed, 25 insertions, 26 deletions
diff --git a/configure b/configure
index ff21509..6975a29 100755
--- a/configure
+++ b/configure
@@ -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 \
diff --git a/ex.c b/ex.c
index 8d9f496..f1b4fa5 100644
--- a/ex.c
+++ b/ex.c
@@ -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)
{
diff --git a/gg.c b/gg.c
index eb5098a..8a1e7eb 100644
--- a/gg.c
+++ b/gg.c
@@ -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;
diff --git a/gmid.c b/gmid.c
index bcebfbc..b17fb4f 100644
--- a/gmid.c
+++ b/gmid.c
@@ -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];
diff --git a/gmid.h b/gmid.h
index a2e6be5..a8fd595 100644
--- a/gmid.h
+++ b/gmid.h
@@ -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
diff --git a/iri.c b/iri.c
index b911b0d..442af15 100644
--- a/iri.c
+++ b/iri.c
@@ -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)
{
diff --git a/log.c b/log.c
index 26bd988..7f2d555 100644
--- a/log.c
+++ b/log.c
@@ -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, ...)
{
diff --git a/mime.c b/mime.c
index f8fdd67..7fb444d 100644
--- a/mime.c
+++ b/mime.c
@@ -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)
{
diff --git a/puny.c b/puny.c
index b28065c..7c3c92e 100644
--- a/puny.c
+++ b/puny.c
@@ -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
diff --git a/server.c b/server.c
index 777815e..a677ab5 100644
--- a/server.c
+++ b/server.c
@@ -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;
diff --git a/utf8.c b/utf8.c
index 20985b4..341da33 100644
--- a/utf8.c
+++ b/utf8.c
@@ -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
diff --git a/utils.c b/utils.c
index 9c88b83..e35357b 100644
--- a/utils.c
+++ b/utils.c
@@ -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)",