vfs: check userland buffers before reading them.
[haiku.git] / src / kits / print / PrintTransportAddOn.cpp
blob9ab4efbaf111fd210b40eeb7ddb3f456cea2a5e1
1 #include "PrintTransportAddOn.h"
3 // We don't support multiple instances of the same transport add-on
4 static BDataIO* gTransport = NULL;
6 extern "C" _EXPORT BDataIO *init_transport(BMessage *msg)
8 if (msg == NULL || gTransport != NULL)
9 return NULL;
11 const char *spool_path = msg->FindString("printer_file");
13 if (spool_path && *spool_path != '\0') {
14 BDirectory printer(spool_path);
16 if (printer.InitCheck() == B_OK) {
17 gTransport = instantiate_transport(&printer, msg);
18 return gTransport;
22 return NULL;
25 extern "C" _EXPORT void exit_transport()
27 if (gTransport) {
28 delete gTransport;
29 gTransport = NULL;