vfs: check userland buffers before reading them.
[haiku.git] / src / kits / debugger / jobs / WriteCoreFileJob.cpp
blobf9aa361c95cc5dbbda73751d64813099161be2ed
1 /*
2 * Copyright 2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "Jobs.h"
8 #include <Path.h>
10 #include <AutoLocker.h>
12 #include "DebuggerInterface.h"
13 #include "Team.h"
17 WriteCoreFileJob::WriteCoreFileJob(Team* team,
18 DebuggerInterface* interface, const entry_ref& path)
20 fKey(&path, JOB_TYPE_WRITE_CORE_FILE),
21 fTeam(team),
22 fDebuggerInterface(interface),
23 fTargetPath(path)
25 fDebuggerInterface->AcquireReference();
29 WriteCoreFileJob::~WriteCoreFileJob()
31 fDebuggerInterface->AcquireReference();
35 const JobKey&
36 WriteCoreFileJob::Key() const
38 return fKey;
42 status_t
43 WriteCoreFileJob::Do()
45 BPath path(&fTargetPath);
46 status_t error = path.InitCheck();
47 if (error != B_OK)
48 return error;
50 error = fDebuggerInterface->WriteCoreFile(path.Path());
51 if (error != B_OK)
52 return error;
54 AutoLocker< ::Team> teamLocker(fTeam);
55 fTeam->NotifyCoreFileChanged(path.Path());
57 return B_OK;