gpakosz / whereami

Locate the current running executable and the current running module/library on the file system πŸ”Ž
MIT License
472 stars 64 forks source link

linux: sometimes <limits.h> does not define PATH_MAX #14

Closed jcelerier closed 6 years ago

gpakosz commented 6 years ago

Hello @jcelerier πŸ‘‹

What do you think of

#if defined(__linux__)
#include <linux/limits.h>
#else
#include <limits.h>
#endif

instead?

jcelerier commented 6 years ago

hi! I'm not knowledgeable enough to tell if it will always be included in linux/limits.h (I would hope so though ! and it looks like it's the case : https://github.com/torvalds/linux/blob/master/include/uapi/linux/limits.h ).

gpakosz commented 6 years ago

On which Linux are you facing this btw?

jcelerier commented 6 years ago

On a raspberry pi, with raspbian.

gpakosz commented 6 years ago

Ok so it just doesn't compile right?

jcelerier commented 6 years ago

yup:

whereami.c:183:15: error: β€˜PATH_MAX’ was not declared in this scope
   char buffer[PATH_MAX];
               ^~~~~~~~
gpakosz commented 6 years ago

Can you please make you second commit a fixup of the first one? So that you have a single commit with a nice commit message? πŸ™

jcelerier commented 6 years ago

I squashed them in a single commit.

gpakosz commented 6 years ago

Thanks for the PR πŸ‘

jcelerier commented 6 years ago

thanks !