Sanitize username used for constructing log filenames.
On Windows, os/user.Current may return a username containing a backslash.
diff --git a/glog_file.go b/glog_file.go
index 1a1ed66..8dcb2bc 100644
--- a/glog_file.go
+++ b/glog_file.go
@@ -64,6 +64,9 @@
if err == nil {
userName = current.Username
}
+
+ // Sanitize userName since it may contain filepath separators on Windows.
+ userName = strings.Replace(userName, `\`, "_", -1)
}
// shortHostname returns its argument, truncating at the first period.