mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
Split Windows/POSIX implementations of ncat_openlog.
O_BINARY doesn't exist on POSIX.
This commit is contained in:
parent
8477e0586a
commit
1c0e86596e
3 changed files with 16 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue