Fix compiler warnings

This commit is contained in:
Kovid Goyal 2023-10-01 12:46:42 +05:30
parent 708ccd8c9e
commit c09d5c9e68
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -26,16 +26,21 @@ int main(int argc, char **argv) {
}
strncpy(lib, buf, PATHLEN);
strncpy(base, dirname(lib), PATHLEN);
snprintf(exe, PATHLEN, "%s/bin/%s", base, basename(buf));
int ret = snprintf(exe, PATHLEN, "%s/bin/%s", base, basename(buf));
if (ret < 0 || ret > (PATHLEN-2)) { fprintf(stderr, "Path to executable too long: %s/bin/%s", base, basename(buf)); return 1; }
memset(lib, 0, PATHLEN);
snprintf(lib, PATHLEN, "%s/lib", base);
ret = snprintf(lib, PATHLEN, "%s/lib", base);
if (ret < 0 || ret > (PATHLEN-2)) { fprintf(stderr, "Path to lib too long: %s/lib", base); return 1; }
SET("CALIBRE_QT_PREFIX", base)
memset(buf, 0, PATHLEN);
ldp = getenv("LD_LIBRARY_PATH");
if (ldp == NULL) strncpy(buf, lib, PATHLEN);
else snprintf(buf, PATHLEN, "%s:%s", lib, ldp);
else {
ret = snprintf(buf, PATHLEN, "%s:%s", lib, ldp);
if (ret < 0 || ret > (PATHLEN-2)) { fprintf(stderr, "LD_LIBRARY_PATH too long: %s:%s", lib, ldp); return 1; }
}
SET("LD_LIBRARY_PATH", buf)
argv[0] = exe;