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:
@@ -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)
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user