[Vm-dev] FileAttributesPlugin missing header

Alistair Grant akgrant0710 at gmail.com
Fri Mar 9 07:09:14 UTC 2018


Hi Tobias,


On 9 March 2018 at 00:00, Tobias Pape <Das.Linux at gmx.de> wrote:
>
> Hi All, Hi Alistair
>
> Good to have the new file attributes plugin.
>
> However, it has a compile error: it uses PATH_MAX, but for this to work it needs <limits.h>
>
> in my branch I already include limits.h but this is only sufficient on linux, where limits.h gets included by some other system header, apparently.
>
>
> Here's the code: FileAttributesPlugin.c
> ============================================= snip ============================================================
>
>
> #include "config.h"
> #include <math.h>                                // <<< system headers that might not include limits.h
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <time.h>
> #include <sys/types.h>
> #include <dirent.h>
> #ifdef WIN32
> #include <windows.h>
> #include <winbase.h>
> #define FAIL() { return -1; }
> #include "sqWin32File.h"
> #endif
> typedef struct dirptrstruct {
>                 DIR *dp;
>                 int path_len;
>                 char *path_file;
>                 char path[PATH_MAX+4];             // << use of PATH_MAX from limits.h
>                 } osdir;
> #include <sys/stat.h>
> #if !defined(HAVE_LSTAT) && !defined(WIN32)
> #define HAVE_LSTAT 1
> #endif
> #include <unistd.h>
> /* AKG 2017 - FileAttributesPlugin.c translated from class FileAttributesPlugin */
>
> /* Default EXPORT macro that does nothing (see comment in sq.h): */
> #define EXPORT(returnType) returnType
> ================================================= snap ==========================================
>
> Can someone please "#include <limits.h>"  somewhere there?


Shall do.

Cheers,
Alistair


More information about the Vm-dev mailing list