Skip to content

Commit 28f2e81

Browse files
committed
fix(fsim.upload): create temp files in the upload destination folder
Create the temp files in the upload destination folder instead of `/tmp` to avoid "invalid cross-device link" errors. Signed-off-by: Miguel Martín <[email protected]>
1 parent 020d862 commit 28f2e81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/owner.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ func ownerModules(modules []string) iter.Seq2[string, serviceinfo.OwnerModule] {
325325
if !yield("fdo.upload", &fsim.UploadRequest{
326326
Dir: uploadDir,
327327
Name: name,
328+
CreateTemp: func() (*os.File, error) {
329+
return os.CreateTemp(uploadDir, ".fdo-upload_*")
330+
},
328331
}) {
329332
return
330333
}
@@ -362,7 +365,7 @@ func ownerModules(modules []string) iter.Seq2[string, serviceinfo.OwnerModule] {
362365
func init() {
363366
rootCmd.AddCommand(ownerCmd)
364367

365-
//serveCmd.Flags().StringVar(&externalAddress, "external-address", "", "External `addr`ess devices should connect to (default \"127.0.0.1:${LISTEN_PORT}\")")
368+
// serveCmd.Flags().StringVar(&externalAddress, "external-address", "", "External `addr`ess devices should connect to (default \"127.0.0.1:${LISTEN_PORT}\")")
366369
ownerCmd.Flags().BoolVar(&date, "command-date", false, "Use fdo.command FSIM to have device run \"date --utc\"")
367370
ownerCmd.Flags().StringArrayVar(&wgets, "command-wget", nil, "Use fdo.wget FSIM for each `url` (flag may be used multiple times)")
368371
ownerCmd.Flags().StringArrayVar(&uploads, "command-upload", nil, "Use fdo.upload FSIM for each `file` (flag may be used multiple times)")
@@ -372,5 +375,4 @@ func init() {
372375
ownerCmd.Flags().StringVar(&ownerDeviceCACert, "device-ca-cert", "", "Device CA certificate path")
373376
ownerCmd.Flags().StringVar(&ownerPrivateKey, "owner-key", "", "Owner private key path")
374377
manufacturingCmd.Flags().StringVar(&externalAddress, "external-address", "", "External `addr`ess devices should connect to (default \"127.0.0.1:${LISTEN_PORT}\")")
375-
376378
}

0 commit comments

Comments
 (0)