Skip to content

Commit

Permalink
Avoid consequent truncation warnings
Browse files Browse the repository at this point in the history
--HG--
branch : rel-3.1
  • Loading branch information
Spivoxity committed Aug 28, 2019
1 parent 2e583ca commit 0e08c8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions runtime/oblink.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ static void scan_files(void) {
if (stdlib) {
char buf[128];

snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, lscript);
if (snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, lscript) < 0)
panic("lscript path truncated");
FILE *fp = fopen(buf, "r");
if (fp == NULL) {
perror(buf);
Expand All @@ -158,7 +159,8 @@ static void scan_files(void) {

while (fgets(line, MAXLINE, fp) != NULL) {
line[strlen(line)-1] = '\0';
snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, line);
if (snprintf(buf, 128, "%s%s%s", libdir, DIRSEP, line) < 0)
panic("library path truncated");
scan(must_strdup(buf), TRUE);
}

Expand Down

0 comments on commit 0e08c8e

Please sign in to comment.