error-check reading of old uidvalidity and maxuid files

found by coverity.
This commit is contained in:
Oswald Buddenhagen 2014-04-12 18:34:26 +02:00
parent 2d4bc1e613
commit 09db83809a

View File

@ -128,13 +128,21 @@ convert( config_t *box )
sys_error( "Cannot open %s", iuvname );
goto err2;
}
fscanf( fp, "%d", &uidval );
if (fscanf( fp, "%d", &uidval ) != 1) {
sys_error( "Cannot read %s", iuvname );
err3:
fclose( fp );
goto err2;
}
fclose( fp );
if (!(fp = fopen( imuname, "r" ))) {
sys_error( "Cannot open %s", imuname );
goto err2;
}
fscanf( fp, "%d", &maxuid );
if (fscanf( fp, "%d", &maxuid ) != 1) {
sys_error( "Cannot read %s", imuname );
goto err3;
}
fclose( fp );
if (!stat( iumname, &sb )) {