mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 11:05:15 +00:00
Minor adjustments and fixed some warnings
This commit is contained in:
parent
87edca99b4
commit
91c095e063
@ -282,7 +282,9 @@ do_detach()
|
||||
{
|
||||
#ifndef WINDOWS32
|
||||
fprintf(stderr, "Detaching from terminal...\n");
|
||||
daemon(0, 0);
|
||||
if (daemon(0, 0) != 0) {
|
||||
err(1, "Failed to detach from terminal. Try running in foreground.");
|
||||
}
|
||||
umask(0);
|
||||
alarm(0);
|
||||
#else
|
||||
@ -310,7 +312,8 @@ read_password(char *buf, size_t len)
|
||||
fprintf(stderr, "Enter password: ");
|
||||
fflush(stderr);
|
||||
#ifndef WINDOWS32
|
||||
fscanf(stdin, "%79[^\n]", pwd);
|
||||
if (!fscanf(stdin, "%79[^\n]", pwd))
|
||||
err(1, "EOF while reading password!");
|
||||
#else
|
||||
for (i = 0; i < sizeof(pwd); i++) {
|
||||
pwd[i] = getch();
|
||||
|
@ -79,7 +79,7 @@ extern const unsigned char raw_header[RAW_HDR_LEN];
|
||||
#define DOWNSTREAM_HDR 3
|
||||
#define DOWNSTREAM_PING_HDR 7
|
||||
#define UPSTREAM_HDR 6
|
||||
#define UPSTREAM_PING 6
|
||||
#define UPSTREAM_PING 11
|
||||
|
||||
/* handy debug printing macro */
|
||||
#define DEBUG(level, ...) \
|
||||
|
@ -408,7 +408,7 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
|
||||
unsigned short type;
|
||||
char *data;
|
||||
unsigned short rlen;
|
||||
int id;
|
||||
uint16_t id;
|
||||
int rv;
|
||||
|
||||
rv = 0;
|
||||
@ -428,7 +428,6 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
|
||||
ancount = ntohs(header->ancount);
|
||||
|
||||
id = ntohs(header->id);
|
||||
id = id & 0xFFFF; /* Kill any sign extension */
|
||||
|
||||
rlen = 0;
|
||||
|
||||
|
@ -43,7 +43,10 @@ get_resolvconf_addr()
|
||||
err(1, "/etc/resolv.conf");
|
||||
|
||||
while (feof(fp) == 0) {
|
||||
fgets(buf, sizeof(buf), fp);
|
||||
if (!fgets(buf, sizeof(buf), fp)) {
|
||||
/* resolv.conf is empty (we got to EOF without reading anything yet */
|
||||
err(1, "/etc/resolv.conf is empty! Please specify a nameserver.");
|
||||
}
|
||||
|
||||
if (sscanf(buf, "nameserver %15s", addr) == 1) {
|
||||
rv = addr;
|
||||
|
Loading…
Reference in New Issue
Block a user