Use option m in fscanf

This commit is contained in:
wbaumann 2019-11-11 16:50:08 +00:00
parent ae38c9eca6
commit 9e88f6b97b
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,10 @@
ChangeLog for davfs2
--------------------

2019-12-11 Werner Baumann (werner.baumann@onlinehome.de)
* umount_davfs.c
Use option 'm' in fscanf.

2019-01-17 Werner Baumann (werner.baumann@onlinehome.de)
* cache.c, xml_end_reg:
Don't remove cache-files because of inconsistent

View File

@ -152,9 +152,9 @@ main(int argc, char *argv[])
char *pidfile = xasprintf("%s/%s.pid", DAV_SYS_RUN, mp);
free(mp);

char pid[32];
char *pid = NULL;
FILE *file = fopen(pidfile, "r");
if (!file || fscanf(file, "%30[0-9]", pid) < 1) {
if (!file || fscanf(file, "%m[0-9]", &pid) != 1 || !pid) {
error(0, 0,
_("\n"
" can't read PID from file %s;\n"