Resolve compiler warning

This commit is contained in:
Night Kaly 2024-11-04 23:15:43 +00:00
parent a97b6fb97a
commit 87dc1a0d89
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM
2 changed files with 8 additions and 7 deletions

View file

@ -9,7 +9,7 @@ BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1 MANDIR = $(PREFIX)/share/man/man1
LDFLAGS != pkg-config --libs libsodium LDFLAGS != pkg-config --libs libsodium
CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE
SRC = apm.c SRC = apm.c

13
apm.c
View file

@ -7,6 +7,8 @@
#include <time.h> #include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <linux/limits.h>
#include <sodium.h> #include <sodium.h>
#include "arg.h" #include "arg.h"
@ -18,6 +20,7 @@
char *argv0; char *argv0;
void die(char *str); void die(char *str);
char *get_master_key(void);
void *memalloc(size_t size) void *memalloc(size_t size)
{ {
@ -29,9 +32,7 @@ void *memalloc(size_t size)
return ptr; return ptr;
} }
char *get_master_key(); void usage(void)
void usage()
{ {
printf("Usage: %s [-vhL] [[-e | -R | -I | -Q] <password>] [-M <file>] [-G <password> <length>]\n", argv0); printf("Usage: %s [-vhL] [[-e | -R | -I | -Q] <password>] [-M <file>] [-G <password> <length>]\n", argv0);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -87,7 +88,7 @@ void tree(const char *basepath, int depth)
closedir(dir); closedir(dir);
} }
char *get_apm() char *get_apm(void)
{ {
char dirname[] = "apm"; char dirname[] = "apm";
const char *apm_dir = getenv("APM_DIR"); const char *apm_dir = getenv("APM_DIR");
@ -138,7 +139,7 @@ char *get_passfile(const char *key)
return path; return path;
} }
char *get_password() char *get_password(void)
{ {
size_t len; size_t len;
char *password = NULL; char *password = NULL;
@ -273,7 +274,7 @@ void decrypt_password(const char *name, int open)
fclose(file); fclose(file);
} }
char *get_master_key() char *get_master_key(void)
{ {
char *key_path = getenv("APM_KEY"); char *key_path = getenv("APM_KEY");
char *m_key = NULL; char *m_key = NULL;