Aware of sscanf return value

This commit is contained in:
dwarning 2021-10-31 15:05:29 +01:00 committed by Holger Vogt
parent ba6d8c871c
commit 8f9bf94a38
1 changed files with 4 additions and 2 deletions

View File

@ -26,8 +26,10 @@ char *INPfindVer(char *line, char *version)
}
/* now the magic string */
sscanf(where, "%s", version); /* We get the version number */
if (sscanf(where, "%s", version) != 1) { /* We get the version number */
sprintf( version, "default" );
printf("Warning -- Version not specified correct on line \"%s\"\nSetting version to 'default'.\n", line);
}
return (NULL);
}
else { /* no level on the line => default */