Ownership for more...
This commit is contained in:
+4
-6
@@ -98,7 +98,7 @@ struct ClientInfo {
|
|||||||
std::optional< std::string > filename;
|
std::optional< std::string > filename;
|
||||||
int file_fd;
|
int file_fd;
|
||||||
off_t file_sz;
|
off_t file_sz;
|
||||||
DilloDir *d_dir;
|
std::unique_ptr< DilloDir > d_dir;
|
||||||
FileState state;
|
FileState state;
|
||||||
int err_code;
|
int err_code;
|
||||||
int flags;
|
int flags;
|
||||||
@@ -408,7 +408,7 @@ static void File_send_dir(ClientInfo *client)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char *d_cmd, *Hdirname, *HUdirname;
|
char *d_cmd, *Hdirname, *HUdirname;
|
||||||
DilloDir *Ddir = client->d_dir;
|
DilloDir *Ddir = client->d_dir.get();
|
||||||
|
|
||||||
if (client->state == st_start) {
|
if (client->state == st_start) {
|
||||||
/* Send DPI command */
|
/* Send DPI command */
|
||||||
@@ -608,7 +608,6 @@ static int File_prepare_send_dir(ClientInfo *client,
|
|||||||
const char *DirName, const std::string_view orig_url)
|
const char *DirName, const std::string_view orig_url)
|
||||||
{
|
{
|
||||||
std::string ds_dirname;
|
std::string ds_dirname;
|
||||||
DilloDir *Ddir;
|
|
||||||
|
|
||||||
/* Let's make sure this directory url has a trailing slash */
|
/* Let's make sure this directory url has a trailing slash */
|
||||||
ds_dirname = DirName;
|
ds_dirname = DirName;
|
||||||
@@ -616,11 +615,11 @@ static int File_prepare_send_dir(ClientInfo *client,
|
|||||||
ds_dirname+= "/";
|
ds_dirname+= "/";
|
||||||
|
|
||||||
/* Let's get a structure ready for transfer */
|
/* Let's get a structure ready for transfer */
|
||||||
Ddir = File_dillodir_new(ds_dirname.c_str()).release();
|
auto Ddir = File_dillodir_new(ds_dirname.c_str());
|
||||||
if (Ddir) {
|
if (Ddir) {
|
||||||
/* looks ok, set things accordingly */
|
/* looks ok, set things accordingly */
|
||||||
client->orig_url = orig_url;
|
client->orig_url = orig_url;
|
||||||
client->d_dir = Ddir;
|
client->d_dir = std::move( Ddir );
|
||||||
client->state = st_start;
|
client->state = st_start;
|
||||||
client->flags &= ~FILE_READ;
|
client->flags &= ~FILE_READ;
|
||||||
client->flags |= FILE_WRITE;
|
client->flags |= FILE_WRITE;
|
||||||
@@ -916,7 +915,6 @@ ClientInfo::~ClientInfo()
|
|||||||
a_Dpip_dsh_close(sh);
|
a_Dpip_dsh_close(sh);
|
||||||
a_Dpip_dsh_free(sh);
|
a_Dpip_dsh_free(sh);
|
||||||
File_close(file_fd);
|
File_close(file_fd);
|
||||||
delete d_dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user