This commit is contained in:
Viktor Liu
2025-07-02 20:10:59 +02:00
parent 279b77dee0
commit 4bbca28eb6
19 changed files with 71 additions and 417 deletions

View File

@@ -86,9 +86,15 @@ func sftpMain(cmd *cobra.Command, _ []string) error {
log.Tracef("starting SFTP server with dropped privileges")
if err := sftpServer.Serve(); err != nil && !errors.Is(err, io.EOF) {
cmd.PrintErrf("SFTP server error: %v\n", err)
if closeErr := sftpServer.Close(); closeErr != nil {
cmd.PrintErrf("SFTP server close error: %v\n", closeErr)
}
os.Exit(sshserver.ExitCodeShellExecFail)
}
if closeErr := sftpServer.Close(); closeErr != nil {
cmd.PrintErrf("SFTP server close error: %v\n", closeErr)
}
os.Exit(sshserver.ExitCodeSuccess)
return nil
}