1
1

locking: accept a minimal amount of data, enough for PID plus username

Maybe reading from a remote filesystem happens in small chunks;
don't call foul when the first chunk contains all we need.
Этот коммит содержится в:
Benno Schulenberg 2020-02-06 16:00:48 +01:00
родитель 0856f53703
Коммит 325d774393

Просмотреть файл

@ -289,7 +289,9 @@ int do_lockfile(const char *filename, bool ask_the_user)
close(lockfd);
if (readamt < LOCKSIZE || lockbuf[0] != 0x62 || lockbuf[1] != 0x30) {
/* If not enough data has been read to show the needed things,
* or the two magic bytes are not there, skip the lock file. */
if (readamt < 68 || lockbuf[0] != 0x62 || lockbuf[1] != 0x30) {
statusline(ALERT, _("Bad lock file is ignored: %s"), lockfilename);
free(lockbuf);
goto free_the_name;