if !dryRun && jobPath != "" {
if doSeen {
if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
- fd.Close() // #nosec G104
+ fd.Close()
+ if err = DirSync(filepath.Base(jobPath)); err != nil {
+ ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing file %s/%s (%s): %s: dirsyncing",
+ sender.Name, pktName,
+ humanize.IBytes(pktSize),
+ filepath.Base(jobPath),
+ )
+ })
+ return err
+ }
}
}
if err = os.Remove(jobPath); err != nil {
if jobPath != "" {
if doSeen {
if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
- fd.Close() // #nosec G104
+ fd.Close()
+ if err = DirSync(filepath.Base(jobPath)); err != nil {
+ ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing file %s/%s (%s): %s: dirsyncing",
+ sender.Name, pktName,
+ humanize.IBytes(pktSize),
+ filepath.Base(jobPath),
+ )
+ })
+ return err
+ }
}
}
if err = os.Remove(jobPath); err != nil {
if jobPath != "" {
if doSeen {
if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
- fd.Close() // #nosec G104
+ fd.Close()
+ if err = DirSync(filepath.Base(jobPath)); err != nil {
+ ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing file %s/%s (%s): %s: dirsyncing",
+ sender.Name, pktName,
+ humanize.IBytes(pktSize),
+ filepath.Base(jobPath),
+ )
+ })
+ return err
+ }
}
}
if err = os.Remove(jobPath); err != nil {
if !dryRun && jobPath != "" {
if doSeen {
if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
- fd.Close() // #nosec G104
+ fd.Close()
+ if err = DirSync(filepath.Base(jobPath)); err != nil {
+ ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing file %s/%s (%s): %s: dirsyncing",
+ sender.Name, pktName,
+ humanize.IBytes(pktSize),
+ filepath.Base(jobPath),
+ )
+ })
+ return err
+ }
}
}
if err = os.Remove(jobPath); err != nil {