FreeBSD Bugzilla – Attachment 242439 Details for
Bug 271668
net/syncthing: Patch to set umask
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add umask setting
patch-syncthing_umask (text/plain), 2.22 KB, created by
Daniel O'Connor
on 2023-05-27 10:36:24 UTC
(
hide
)
Description:
Patch to add umask setting
Filename:
MIME Type:
Creator:
Daniel O'Connor
Created:
2023-05-27 10:36:24 UTC
Size:
2.22 KB
patch
obsolete
>--- syncthing/cmd/syncthing/main.go.orig 2023-01-18 05:01:24.031208000 +0000 >+++ syncthing/cmd/syncthing/main.go 2023-01-18 05:10:40.810011000 +0000 >@@ -158,6 +158,7 @@ > NoUpgrade bool `env:"STNOUPGRADE" help:"Disable automatic upgrades"` > Paths bool `help:"Show configuration paths"` > Paused bool `help:"Start with all devices and folders paused"` >+ Umask string `help:"Set process umask"` > Unpaused bool `help:"Start with all devices and folders unpaused"` > Upgrade bool `help:"Perform upgrade"` > UpgradeCheck bool `help:"Check for available upgrade"` >@@ -270,6 +271,20 @@ > // serveOptions.Run() is the entrypoint for `syncthing serve` > func (options serveOptions) Run() error { > l.SetFlags(options.LogFlags) >+ >+ if runtime.GOOS != "windows" && options.Umask != "" { >+ var mask int64 >+ var err error >+ if mask, err = strconv.ParseInt(options.Umask, 0, 9); err != nil { >+ l.Warnln("Failed to parse umask:", err) >+ os.Exit(1) >+ } >+ if mask < 0 || mask > 0777 { >+ l.Warnln("Umask invalid, must between 0000 and 0777") >+ os.Exit(1) >+ } >+ umask(int(mask)) >+ } > > if options.GUIAddress != "" { > // The config picks this up from the environment. >--- /dev/null 2023-01-18 05:11:36.884728000 +0000 >+++ syncthing/cmd/syncthing/umask_unix.go 2023-01-18 05:08:49.242042000 +0000 >@@ -0,0 +1,18 @@ >+// Copyright (C) 2019 The Syncthing Authors. >+// >+// This Source Code Form is subject to the terms of the Mozilla Public >+// License, v. 2.0. If a copy of the MPL was not distributed with this file, >+// You can obtain one at https://mozilla.org/MPL/2.0/. >+ >+// +build !windows >+ >+package main >+ >+import ( >+ "syscall" >+) >+ >+func umask(mask int) int { >+ return syscall.Umask(mask) >+} >+ >--- /dev/null 2023-01-18 05:11:41.868980000 +0000 >+++ syncthing/cmd/syncthing/umask_windows.go 2023-01-18 05:09:33.175300000 +0000 >@@ -0,0 +1,14 @@ >+// Copyright (C) 2019 The Syncthing Authors. >+// >+// This Source Code Form is subject to the terms of the Mozilla Public >+// License, v. 2.0. If a copy of the MPL was not distributed with this file, >+// You can obtain one at https://mozilla.org/MPL/2.0/. >+ >+// +build windows >+ >+package main >+ >+func umask(mask int) int { >+ panic("umask called for Windows") >+} >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 271668
: 242439