Skip to content

I get loads of warnings when I try to compile this #1

@sbrl

Description

@sbrl

If I try to compile this on Ubuntu Server 15.10, I get a brunch of warnings. Here they are:

tiny.c: In function ‘handle_directory_request’:
tiny.c:173:14: warning: implicit declaration of function ‘fdopendir’ [-Wimplicit-function-declaration]
     DIR *d = fdopendir(dir_fd);
              ^
tiny.c:173:14: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
tiny.c:180:20: warning: implicit declaration of function ‘openat’ [-Wimplicit-function-declaration]
         if ((ffd = openat(dir_fd, dp->d_name, O_RDONLY)) == -1){
                    ^
tiny.c: In function ‘serve_static’:
tiny.c:340:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘off_t {aka long int}’ [-Wformat=]
         printf("offset: %d \n\n", offset);
                ^
tiny.c: In function ‘main’:
tiny.c:386:11: warning: variable ‘path’ set but not used [-Wunused-but-set-variable]
     char *path = getcwd(buf, 256);
           ^

Additional information:

tiny-web-server$ c99 --version
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

tiny-web-server$ uname -a
Linux starbeamrainbowlabs.com 2.6.32-042stab111.12 #1 SMP Thu Sep 17 11:38:20 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions