#define F_AUTOREADONLY 8 /**< flag to tell us a file is set to autoreadonly */
GHashTable *children;
char pidfname[256]; /**< name of our PID file */
+char default_authname[] = "/etc/nbd_server.allow"; /**< default name of allow file */
/**
* Variables associated with a server.
case 'm':
serve->flags |= F_MULTIFILE;
serve->hunksize = 1*GIGA;
+ serve->authname = default_authname;
break;
case 'c':
serve->flags |=F_COPYONWRITE;
void sigchld_handler(int s) {
int* status=NULL;
int* i;
- char buf[80];
pid_t pid;
while((pid=wait(status)) > 0) {
* is severely wrong).
**/
void sigterm_handler(int s) {
- int i;
int parent=0;
g_hash_table_foreach(children, killchild, &parent);
writeit(client->net, buf, len + sizeof(struct nbd_reply));
DEBUG("OK!\n");
}
+ return 0;
}
/**
* @param net A network socket connected to an nbd client
**/
void serveconnection(CLIENT *client) {
- char buf[80];
splitexport(client);
if (!client->server->expected_size) {
struct sockaddr_in addrin;
struct sigaction sa;
int addrinlen = sizeof(addrin);
- int newpid, i;
#ifndef sun
int yes=1;
#else
/**
* Loop through the available servers, and serve them.
*
+ * Actually, right now we only handle one server. Will change that for
+ * 2.9.
**/
int serveloop(SERVER* serve) {
struct sockaddr_in addrin;
- int addrinlen=sizeof(addrin);
+ socklen_t addrinlen=sizeof(addrin);
for(;;) {
CLIENT *client;
int net;
}
/* child */
g_hash_table_destroy(children);
- close(sock) ;
+ close(serve->socket) ;
#endif // NOFORK
msg2(LOG_INFO,"Starting to serve") ;
serveconnection(client);