فهرست منبع

Sanitize username used for constructing log filenames.

On Windows, os/user.Current may return a username containing a backslash.
David Symonds 12 سال پیش
والد
کامیت
ab6a54c30d
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      glog_file.go

+ 3 - 0
glog_file.go

@@ -64,6 +64,9 @@ func init() {
 	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.