summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-11-18 16:26:01 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-11-18 16:26:01 +0100
commit28b24f2286a8fdea2670cfacbdd252a697dbb10f (patch)
treeb8d7051f9d7d487a87a5543c5af33d306b96b602
parente3333982b0899c40d34c93dca7b767b190c97fae (diff)
Fix setting the NUL caracter
-rw-r--r--user/tlecarrour/porting_guide_for_dummies.mdwn2
1 files changed, 1 insertions, 1 deletions
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()