Fix previous commit break: Handle case of non override of locked file in Linux.

This commit is contained in:
Renaud 2016-03-30 20:14:19 +08:00
parent ac3c2aa6dd
commit af23c6b3b5
1 changed files with 4 additions and 3 deletions

7
file.c
View File

@ -254,20 +254,20 @@ int readin(const char *fname, boolean lockfl)
int status ; int status ;
fio_code s ; fio_code s ;
bp = curbp; /* Cheap. */
#if (FILOCK && BSD) || SVR4 #if (FILOCK && BSD) || SVR4
if (lockfl && lockchk(fname) == ABORT) if( lockfl && lockchk( fname) == ABORT)
#if PKCODE #if PKCODE
{ {
s = FIOFNF; s = FIOFNF;
bp = curbp;
strcpy(bp->b_fname, ""); strcpy(bp->b_fname, "");
mloutstr( "(File in use)") ;
goto out; goto out;
} }
#else #else
return ABORT; return ABORT;
#endif #endif
#endif #endif
bp = curbp; /* Cheap. */
if( (status = bclear( bp)) != TRUE) /* Might be old. */ if( (status = bclear( bp)) != TRUE) /* Might be old. */
return status ; return status ;
@ -349,6 +349,7 @@ int readin(const char *fname, boolean lockfl)
ffclose() ; /* Ignore errors. */ ffclose() ; /* Ignore errors. */
} }
out:
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_bufp == curbp) { if (wp->w_bufp == curbp) {
wp->w_linep = lforw(curbp->b_linep); wp->w_linep = lforw(curbp->b_linep);