Skip to content
Permalink
Browse files

Fix dependency to pthread.

This makes the legacy version of the server finally work!
  • Loading branch information
NoraCodes committed Oct 19, 2016
1 parent a1ae783 commit 8e938ec4943fc859d8bd7eff0dafd13c7a23b168
Showing with 7 additions and 11 deletions.
  1. +1 −1 legacy/Makefile
  2. +6 −10 legacy/httpd.c
@@ -1,7 +1,7 @@
all: httpd

httpd: httpd.c
gcc -W -Wall -lpthread -o httpd httpd.c
gcc -W -Wall -pthread -o httpd httpd.c

clean:
rm httpd
@@ -17,13 +17,12 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <unistd.h>
#include <ctype.h>
#include <strings.h>
#include <string.h>
#include <sys/stat.h>
// Commented out in order to build on Linux
//#include <pthread.h>
#include <pthread.h>
#include <sys/wait.h>
#include <stdlib.h>

@@ -499,15 +498,13 @@ void unimplemented(int client)

/**********************************************************************/

int main(void)
{
int main(void) {
int server_sock = -1;
int client_sock = -1;
u_short port = 9999;
struct sockaddr_in client_name;
socklen_t client_name_len = sizeof(client_name);
// Commented out to build on Linux
//pthread_t newthread;
pthread_t newthread;

signal(SIGPIPE, SIG_IGN);

@@ -522,12 +519,11 @@ int main(void)
error_die("accept");
}

// Commented out in order to build on Linux
/* if (pthread_create(&newthread , NULL, (void *)accept_request, (void *)&client_sock) != 0)
if (pthread_create(&newthread , NULL, (void *)accept_request, (void *)&client_sock) != 0)
{
perror("pthread_create");
}
*/

}

close(server_sock);

0 comments on commit 8e938ec

Please sign in to comment.
You can’t perform that action at this time.