From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3302 invoked by alias); 7 Apr 2011 23:44:38 -0000 Received: (qmail 3291 invoked by uid 22791); 7 Apr 2011 23:44:37 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Apr 2011 23:44:34 +0000 Received: (qmail 25239 invoked from network); 7 Apr 2011 23:44:33 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Apr 2011 23:44:33 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFA 2/2] Remove old Cygwin1.5 support Date: Thu, 07 Apr 2011 23:44:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.1; x86_64; ; ) Cc: "Pierre Muller" References: <005101cbf4ae$1dca5fc0$595f1f40$@muller@ics-cnrs.unistra.fr> In-Reply-To: <005101cbf4ae$1dca5fc0$595f1f40$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201104080044.27841.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00118.txt.bz2 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