Open firmware images in binary mode on Windows
This commit is contained in:
parent
21bc62f762
commit
6d108dc2ed
1 changed files with 5 additions and 1 deletions
6
tftp.c
6
tftp.c
|
|
@ -26,6 +26,10 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "nmrpd.h"
|
#include "nmrpd.h"
|
||||||
|
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TFTP_PKT_SIZE 516
|
#define TFTP_PKT_SIZE 516
|
||||||
|
|
||||||
static const char *opcode_names[] = {
|
static const char *opcode_names[] = {
|
||||||
|
|
@ -237,7 +241,7 @@ int tftp_put(struct nmrpd_args *args)
|
||||||
if (!strcmp(args->file_local, "-")) {
|
if (!strcmp(args->file_local, "-")) {
|
||||||
fd = STDIN_FILENO;
|
fd = STDIN_FILENO;
|
||||||
} else {
|
} else {
|
||||||
fd = open(args->file_local, O_RDONLY);
|
fd = open(args->file_local, O_RDONLY | O_BINARY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("open");
|
perror("open");
|
||||||
ret = fd;
|
ret = fd;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue