mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix compiler warnings
This commit is contained in:
parent
708ccd8c9e
commit
c09d5c9e68
@ -26,16 +26,21 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
strncpy(lib, buf, PATHLEN);
|
strncpy(lib, buf, PATHLEN);
|
||||||
strncpy(base, dirname(lib), 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);
|
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)
|
SET("CALIBRE_QT_PREFIX", base)
|
||||||
|
|
||||||
memset(buf, 0, PATHLEN);
|
memset(buf, 0, PATHLEN);
|
||||||
ldp = getenv("LD_LIBRARY_PATH");
|
ldp = getenv("LD_LIBRARY_PATH");
|
||||||
if (ldp == NULL) strncpy(buf, lib, PATHLEN);
|
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)
|
SET("LD_LIBRARY_PATH", buf)
|
||||||
|
|
||||||
argv[0] = exe;
|
argv[0] = exe;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user