poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compilation error on GNU/Hurd


From: Jose E. Marchesi
Subject: Re: compilation error on GNU/Hurd
Date: Sun, 07 Mar 2021 20:14:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Yes, now that poke works on 32-bit we can support the Hurd too :)

OK for master.
Thanks!


> On GNU/Hurd I see a compilation error:
>
> ../../poke/pk-cmd-editor.c: In function 'pk_cmd_editor':
> ../../poke/pk-cmd-editor.c:69:37: error: 'PATH_MAX' undeclared (first use in 
> this function); did you mean 'INT8_MAX'?
>    if (((des = path_search (tmpfile, PATH_MAX, NULL, "poke", true)) == -1)
>                                      ^~~~~~~~
>                                      INT8_MAX
> ../../poke/pk-cmd-editor.c:69:37: note: each undeclared identifier is 
> reported only once for each function it appears in
> Makefile:2415: recipe for target 'poke-pk-cmd-editor.o' failed
> make[2]: *** [poke-pk-cmd-editor.o] Error 1
>
> This proposed patch fixes it.
>
>>From 3985507aaa169aef297d79d6cf5b1eca732ced7c Mon Sep 17 00:00:00 2001
> From: Bruno Haible <bruno@clisp.org>
> Date: Sun, 7 Mar 2021 11:15:43 +0100
> Subject: [PATCH] Fix compilation error on GNU/Hurd.
>
> * poke/pk-cmd-editor.c (PATH_MAX): Define fallback.
> (pk_cmd_editor): Fix buffer overrun when PATH_MAX > 1024.
> ---
>  poke/pk-cmd-editor.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/poke/pk-cmd-editor.c b/poke/pk-cmd-editor.c
> index e04baa0..91c85d0 100644
> --- a/poke/pk-cmd-editor.c
> +++ b/poke/pk-cmd-editor.c
> @@ -30,12 +30,16 @@
>  #include "pk-cmd.h"
>  #include "pk-utils.h"
>  
> +#ifndef PATH_MAX /* GNU/Hurd */
> +# define PATH_MAX (64 * 1024)
> +#endif
> +
>  static int
>  pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t uflags)
>  {
>    const char *editor;
>    char *cmdline;
> -  char tmpfile[1024];
> +  char tmpfile[PATH_MAX];
>    int des;
>    FILE *fp;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]