mirror of
https://github.com/samba-team/samba.git
synced 2025-11-23 20:23:50 +03:00
rpc_server3: Use fdopen_keepfd()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
This commit is contained in:
committed by
Martin Schwenke
parent
28335cdb5d
commit
b6f4acb9b4
@@ -2309,7 +2309,6 @@ static bool rpc_host_dump_status_filter(
|
|||||||
struct rpc_server **servers = host->servers;
|
struct rpc_server **servers = host->servers;
|
||||||
size_t i, num_servers = talloc_array_length(servers);
|
size_t i, num_servers = talloc_array_length(servers);
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
int fd;
|
|
||||||
|
|
||||||
if (rec->msg_type != MSG_RPC_DUMP_STATUS) {
|
if (rec->msg_type != MSG_RPC_DUMP_STATUS) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2319,18 +2318,9 @@ static bool rpc_host_dump_status_filter(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = dup(rec->fds[0]);
|
f = fdopen_keepfd(rec->fds[0], "w");
|
||||||
if (fd == -1) {
|
|
||||||
DBG_DEBUG("dup(%"PRIi64") failed: %s\n",
|
|
||||||
rec->fds[0],
|
|
||||||
strerror(errno));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fdopen(fd, "w");
|
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
DBG_DEBUG("fdopen failed: %s\n", strerror(errno));
|
DBG_DEBUG("fdopen failed: %s\n", strerror(errno));
|
||||||
close(fd);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "source3/librpc/gen_ndr/ndr_rpc_host.h"
|
#include "source3/librpc/gen_ndr/ndr_rpc_host.h"
|
||||||
#include "lib/util/debug.h"
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/fault.h"
|
#include "lib/util/fault.h"
|
||||||
|
#include "lib/util/util_file.h"
|
||||||
#include "rpc_server.h"
|
#include "rpc_server.h"
|
||||||
#include "rpc_pipes.h"
|
#include "rpc_pipes.h"
|
||||||
#include "source3/smbd/proto.h"
|
#include "source3/smbd/proto.h"
|
||||||
@@ -569,7 +570,6 @@ static bool rpc_worker_status_filter(
|
|||||||
private_data, struct rpc_worker);
|
private_data, struct rpc_worker);
|
||||||
struct dcerpc_ncacn_conn *conn = NULL;
|
struct dcerpc_ncacn_conn *conn = NULL;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
int fd;
|
|
||||||
|
|
||||||
if (rec->msg_type != MSG_RPC_DUMP_STATUS) {
|
if (rec->msg_type != MSG_RPC_DUMP_STATUS) {
|
||||||
return false;
|
return false;
|
||||||
@@ -580,18 +580,9 @@ static bool rpc_worker_status_filter(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = dup(rec->fds[0]);
|
f = fdopen_keepfd(rec->fds[0], "w");
|
||||||
if (fd == -1) {
|
|
||||||
DBG_DEBUG("dup(%"PRIi64") failed: %s\n",
|
|
||||||
rec->fds[0],
|
|
||||||
strerror(errno));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fdopen(fd, "w");
|
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
DBG_DEBUG("fdopen failed: %s\n", strerror(errno));
|
DBG_DEBUG("fdopen_keepfd failed: %s\n", strerror(errno));
|
||||||
close(fd);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user