Patchwork osutil: mark end of string with null char, not 0

login
register
mail settings
Submitter Siddharth Agarwal
Date March 25, 2015, 11:24 p.m.
Message ID <faaf10908909e475e5ae.1427325878@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8274/
State Accepted
Commit 40b05303ac321fc245058e092e442f26562ae6a3
Headers show

Comments

Siddharth Agarwal - March 25, 2015, 11:24 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1427325718 25200
#      Wed Mar 25 16:21:58 2015 -0700
# Node ID faaf10908909e475e5ae1446061a3d27b8355ee1
# Parent  98042b0e19f9a04be3270cecb07915eac3a515cf
osutil: mark end of string with null char, not 0

Noticed this while working on other stuff in the area.
Matt Mackall - March 26, 2015, 8:40 p.m.
On Wed, 2015-03-25 at 16:24 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1427325718 25200
> #      Wed Mar 25 16:21:58 2015 -0700
> # Node ID faaf10908909e475e5ae1446061a3d27b8355ee1
> # Parent  98042b0e19f9a04be3270cecb07915eac3a515cf
> osutil: mark end of string with null char, not 0
> 
> Noticed this while working on other stuff in the area.

Pretty indifferent to this one, but apparently someone cared. Queued for
default, thanks.

Patch

diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -337,7 +337,7 @@ 
 #else
 			strncpy(fullpath + pathlen + 1, ent->d_name,
 				PATH_MAX - pathlen);
-			fullpath[PATH_MAX] = 0;
+			fullpath[PATH_MAX] = '\0';
 			err = lstat(fullpath, &st);
 #endif
 			if (err == -1) {