(emp_config): Non-portable strndup() crept into rev. 1.33. Replace by
portable code.
This commit is contained in:
parent
3a9f9f6b3e
commit
ac0263d2ae
1 changed files with 5 additions and 3 deletions
|
@ -95,9 +95,11 @@ emp_config(char *file)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((slash = strrchr(file, '/')))
|
if ((slash = strrchr(file, '/'))) {
|
||||||
configdir = strndup(file, slash + 1 - file);
|
configdir = malloc(slash - file + 1);
|
||||||
else
|
memcpy(configdir, file, slash - file);
|
||||||
|
configdir[slash - file] = 0;
|
||||||
|
} else
|
||||||
configdir = NULL;
|
configdir = NULL;
|
||||||
|
|
||||||
while (fgets(buf, sizeof buf, fp) != NULL) {
|
while (fgets(buf, sizeof buf, fp) != NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue