1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 08:59:01 +00:00

Split Windows/POSIX implementations of ncat_openlog.

O_BINARY doesn't exist on POSIX.
This commit is contained in:
david
2013-08-16 21:33:41 +00:00
parent 8477e0586a
commit 1c0e86596e
3 changed files with 16 additions and 10 deletions

View File

@@ -454,16 +454,6 @@ int ncat_delay_timer(int delayval)
return 1;
}
/* Open a logfile for writing.
* Return the open file descriptor. */
int ncat_openlog(const char *logfile, int append)
{
if (append)
return Open(logfile, O_BINARY | O_WRONLY | O_CREAT | O_APPEND, 0664);
else
return Open(logfile, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0664);
}
static int ncat_hexdump(int logfd, const char *data, int len);
void ncat_log_send(const char *data, size_t len)

View File

@@ -391,6 +391,14 @@ char **cmdline_split(const char *cmdexec)
return cmd_args;
}
int ncat_openlog(const char *logfile, int append)
{
if (append)
return Open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0664);
else
return Open(logfile, O_WRONLY | O_CREAT | O_TRUNC, 0664);
}
void set_lf_mode(void)
{
/* Nothing needed. */

View File

@@ -124,6 +124,14 @@
#include "nbase.h"
#include "ncat.h"
int ncat_openlog(const char *logfile, int append)
{
if (append)
return Open(logfile, O_BINARY | O_WRONLY | O_CREAT | O_APPEND, 0664);
else
return Open(logfile, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0664);
}
void set_lf_mode(void)
{
/* _O_TEXT (the default setting) converts \r\n to \n on input, making the