From 28b24f2286a8fdea2670cfacbdd252a697dbb10f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 18 Nov 2018 16:26:01 +0100 Subject: Fix setting the NUL caracter --- user/tlecarrour/porting_guide_for_dummies.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user') diff --git a/user/tlecarrour/porting_guide_for_dummies.mdwn b/user/tlecarrour/porting_guide_for_dummies.mdwn index f43119bd..772be2bb 100644 --- a/user/tlecarrour/porting_guide_for_dummies.mdwn +++ b/user/tlecarrour/porting_guide_for_dummies.mdwn @@ -199,7 +199,7 @@ Call readlink(), check return value and set the null char in the linkname: len = readlink(filename, linkname, sb.st_size + 1); if (len < 0 || len > sb.st_size) { ... - linkname[sb.st_size] = '\0'; + linkname[len] = '\0'; ### Alternative use of readlink(): readlink_malloc() -- cgit v1.2.3