This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 2/2] Remove old Cygwin1.5 support


On Wednesday 06 April 2011 23:58:17, Pierre Muller wrote:
>    if (path_ptr)
>      {
> +      int len = cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, NULL,
> 0);

Your use of `len' for the variable's name confused me into
thinking there's an off-by-one below.  The cygwin_conv_path_list function
returns a byte size including the null terminator, not a string
length.  Please rename the variable to `size'.  Okay with that change.

>        orig_path = alloca (strlen (path_ptr) + 1);
> -      new_path = alloca (cygwin_posix_to_win32_path_list_buf_size
> (path_ptr));
> +      new_path = alloca (len);
>        strcpy (orig_path, path_ptr);
> -      cygwin_posix_to_win32_path_list (path_ptr, new_path);
> +      cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, new_path, len);
>        setenv ("PATH", new_path, 1);

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]