On systems using dsymutil the check for the "-g" flag was failing not
because the compiler didn't provide it but because of `/dev/null`
being used as output file.
Those changes fix the following compilation errors on OpenBSD:
src/tofu.c:128:28: error: format specifies type 'long' but the argument has type
'time_t' (aka 'long long') [-Werror,-Wformat]
"SHA-512", fingerprint, expires);
src/gmnlm.c:341:31: error: missing sentinel in function call
[-Werror,-Wsentinel]
execlp("sh", "sh", "-c", cmd);
^
, NULL
On some systems dirname uses a static string for its return value, so
we were calling mkdirs recursively on a string that was continuosly changing.
A check was also added after the `snprintf` to make sure there's no
information loss since there is no limit to the length of the string
returned by `get_data_pathfmt`.
Closes#48.
In file included from .../include/string.h:495,
from src/gmnlm.c:11:
In function ‘strncpy’,
inlined from ‘do_prompts’ at src/gmnlm.c:627:3:
...glibc-2.31-dev/include/bits/string_fortified.h:106:10:
error: ‘__builtin_strncpy’ specified bound 1024 equals
destination size [-Werror=stringop-truncation]
return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
inlined from ‘do_prompts’ at src/gmnlm.c:612:3:
...glibc-2.31-dev/include/bits/string_fortified.h:106:10:
error: ‘__builtin_strncpy’ specified bound 1024 equals destination size
[-Werror=stringop-truncation]
return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: William Casarin <jb55@jb55.com>
dirname has two main problems:
1. It could change in place the string that is passed to it.
2. It uses a static string for its return value, so one should copy it
somewhere else as soon as possible to avoid subsequent calls to
dirname to corrupt his data (see #48).
We avoid 1. passing a copy of `path` to dirname and 2. copying it's
return value into `dname`.
The '-D' option of `install` is not implemented on some systems that
don't use GNU install. Its uses were replaced with `mkdir -p` commands
to eventually provide the missing folders.
My compiler barks about this unitialized variable:
CC src/gmnlm.o
src/gmnlm.c:629:7: error: variable 'result' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (res != GEMINI_OK) {
^~~~~~~~~~~~~~~~
src/gmnlm.c:673:9: note: uninitialized use occurs here
return result;
^~~~~~
src/gmnlm.c:629:3: note: remove the 'if' if its condition is always false
if (res != GEMINI_OK) {
^~~~~~~~~~~~~~~~~~~~~~~
src/gmnlm.c:482:2: note: variable 'result' is declared here
enum prompt_result result;
^
1 error generated.
make: *** [src/gmnlm.o] Error 1
This reverts commit 963700d8d6e31aecfc14e12184637f4c3360f6ed.
Let's make the p command consistent with the others and tell users who
want to navigate to a relative URL unambiguosly to use ./page
The rest of gmni's stuff will remain in ~/.local/share/gmni, but in
order to establish a common location and format for the TOFU file
between Gemini implementations, a more general path is required.