Skip to content

Commit

Permalink
Fix some things
Browse files Browse the repository at this point in the history
  • Loading branch information
Babkock committed Jul 12, 2024
1 parent 1946bbd commit c4cff10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions network/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ static void cerror(FILE *stream, char *cause, char *errno, char *shortm, char *l

static void serve_file(FILE *stream, struct stat *stat, char *filename) {
char *p;
//char filetype[BUFSIZE];
char *filetype;
filetype = (char *)malloc(BUFSIZE);
filetype = (char *)malloc((sizeof(char) * BUFSIZE));
for (int z = 0; z < sizeof(types); z++) {
if (strstr(filename, types[z].extension)) {
strcpy(filetype, types[z].type);
Expand Down Expand Up @@ -160,7 +159,7 @@ static void serve_directory(int cfd, char *filename) {
}
sprintf(buf, "</tbody></table></body></html>");
write(cfd, buf, strlen(buf));
//

free(buf);
buf = NULL;

Expand Down
2 changes: 2 additions & 0 deletions thread/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static void *handler(void *arg) {
sleep(2);
printf("Job %d has finished\n", counter);
pthread_mutex_unlock(lock);
pthread_exit(NULL);
return NULL;
}

Expand Down Expand Up @@ -49,6 +50,7 @@ int main(void) {
pthread_join(tid[i], NULL);
}

pthread_exit(NULL);
pthread_mutex_destroy(lock);
free(lock);
free(tid);
Expand Down

0 comments on commit c4cff10

Please sign in to comment.