* AutoSaveBuffer::generateChild(): return early.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22546 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-01-14 09:04:14 +00:00
parent 2c1b8bc472
commit c81f5add99

View File

@ -2271,12 +2271,13 @@ int AutoSaveBuffer::generateChild()
pid_t const pid = fork(); pid_t const pid = fork();
// If you want to debug the autosave // If you want to debug the autosave
// you should set pid to -1, and comment out the fork. // you should set pid to -1, and comment out the fork.
if (pid == 0 || pid == -1) { if (pid != 0 && pid != -1)
return pid;
// pid = -1 signifies that lyx was unable // pid = -1 signifies that lyx was unable
// to fork. But we will do the save // to fork. But we will do the save
// anyway. // anyway.
bool failed = false; bool failed = false;
FileName const tmp_ret = FileName::tempName("lyxauto"); FileName const tmp_ret = FileName::tempName("lyxauto");
if (!tmp_ret.empty()) { if (!tmp_ret.empty()) {
buffer_.writeFile(tmp_ret); buffer_.writeFile(tmp_ret);
@ -2295,9 +2296,10 @@ int AutoSaveBuffer::generateChild()
buffer_.message(_("Autosave failed!")); buffer_.message(_("Autosave failed!"));
} }
} }
if (pid == 0) // we are the child so... if (pid == 0) // we are the child so...
_exit(0); _exit(0);
}
return pid; return pid;
} }