Module Name:    src
Committed By:   christos
Date:           Sat Sep 14 21:23:34 UTC 2019

Modified Files:
        src/sys/kern: vfs_getcwd.c

Log Message:
- add missing error check
- use '\0' for char const


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/vfs_getcwd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_getcwd.c
diff -u src/sys/kern/vfs_getcwd.c:1.52 src/sys/kern/vfs_getcwd.c:1.53
--- src/sys/kern/vfs_getcwd.c:1.52	Fri Jul 28 11:37:23 2017
+++ src/sys/kern/vfs_getcwd.c	Sat Sep 14 17:23:34 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_getcwd.c,v 1.52 2017/07/28 15:37:23 riastradh Exp $ */
+/* $NetBSD: vfs_getcwd.c,v 1.53 2019/09/14 21:23:34 christos Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.52 2017/07/28 15:37:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.53 2019/09/14 21:23:34 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -570,6 +570,8 @@ vnode_to_path(char *path, size_t len, st
 	error = getcwd_common(dvp, NULL, &bp, path, len / 2,
 	    GETCWD_CHECK_ACCESS, curl);
 	vrele(dvp);
+	if (error != 0)
+		return error;
 
 	/*
 	 * Strip off emulation path for emulated processes looking at
@@ -585,7 +587,7 @@ vnode_to_path(char *path, size_t len, st
 	lenused = bend - bp;
 
 	memcpy(path, bp, lenused);
-	path[lenused] = 0;
+	path[lenused] = '\0';
 
 	return 0;
 }

Reply via email to