From: Alex Riesen Date: Thu, 02 Aug 2007 22:15:18 GMT Subject: Re: [PATCH] Handle the errors from chdir in set_work_tree Message-ID: <20070802221518.GC2829@steel.home> In-Reply-To: <7v8x8ttx7y.fsf@assigned-by-dhcp.cox.net> Junio C Hamano, Thu, Aug 02, 2007 23:58:41 +0200: > "Alex Riesen" writes: > > + if (chdir(dir)) > > + rel = NULL; ... > > Shouldn't it die() instead, though? Dunno. Don't like dying. > Consolidating two of your patches, would this be Ok? Yes, but you may consider replacing strncpy with strlcpy: > + memcpy(dir_buffer, dir, len - suffix_len); > + dir_buffer[len - suffix_len] = '\0'; strlcpy(dir_buffer, dir, len - suffix_len + 1);