Improved procfs hostname implementation to address code review
 suggestions.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 fs/procfs/procfs_vnops.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/procfs/procfs_vnops.cc b/fs/procfs/procfs_vnops.cc
index a9aef72..56ac31e 100644
--- a/fs/procfs/procfs_vnops.cc
+++ b/fs/procfs/procfs_vnops.cc
@@ -354,10 +354,8 @@ static std::string procfs_mounts()
 
 static std::string procfs_hostname()
 {
-    char hostname[4096];
-    memset(hostname, 0, 4096);
-
-    int ret = gethostname(hostname, 4095);
+    char hostname[65];
+    int ret = gethostname(hostname, 65);
     if (ret < 0) {
         return std::string("");
     }
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to