mirror of https://github.com/omar-polo/gmid.git
move mark_nonblock to utils.c
This commit is contained in:
parent
fe40638928
commit
346f28eeaa
2
gmid.h
2
gmid.h
|
@ -220,7 +220,6 @@ const char *vhost_lang(struct vhost*, const char*);
|
|||
const char *vhost_default_mime(struct vhost*, const char*);
|
||||
const char *vhost_index(struct vhost*, const char*);
|
||||
int vhost_auto_index(struct vhost*, const char*);
|
||||
void mark_nonblock(int);
|
||||
void loop(struct tls*, int, int);
|
||||
|
||||
/* ex.c */
|
||||
|
@ -254,6 +253,7 @@ int puny_decode(const char*, char*, size_t, const char**);
|
|||
int starts_with(const char*, const char*);
|
||||
int ends_with(const char*, const char*);
|
||||
ssize_t filesize(int);
|
||||
void mark_nonblock(int);
|
||||
char *absolutify_path(const char*);
|
||||
|
||||
#endif
|
||||
|
|
11
server.c
11
server.c
|
@ -268,17 +268,6 @@ err:
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
mark_nonblock(int fd)
|
||||
{
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) == -1)
|
||||
fatal("fcntl(F_GETFL): %s", strerror(errno));
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
|
||||
fatal("fcntl(F_SETFL): %s", strerror(errno));
|
||||
}
|
||||
|
||||
static void
|
||||
handle_handshake(struct pollfd *fds, struct client *c)
|
||||
{
|
||||
|
|
12
utils.c
12
utils.c
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gmid.h"
|
||||
|
@ -63,6 +64,17 @@ filesize(int fd)
|
|||
return len;
|
||||
}
|
||||
|
||||
void
|
||||
mark_nonblock(int fd)
|
||||
{
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) == -1)
|
||||
fatal("fcntl(F_GETFL): %s", strerror(errno));
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
|
||||
fatal("fcntl(F_SETFL): %s", strerror(errno));
|
||||
}
|
||||
|
||||
char *
|
||||
absolutify_path(const char *path)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue