Skip to content

Commit

Permalink
freebsd: build fix for ARM7 32-bit (#11854)
Browse files Browse the repository at this point in the history
The size of `stat_t` fields is architecture dependent, which was
reportedly causing a build failure on FreeBSD ARM7 32-bit
systems. This changeset matches the behavior we have on Linux.
  • Loading branch information
tgross authored and lgfa29 committed Jan 17, 2022
1 parent c60d33e commit e747045
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/11854.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bug
freebsd: Fixed a build failure on FreeBSD ARM7 32-bit systems
```
3 changes: 2 additions & 1 deletion command/agent/log_file_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ import (
func (l *logFile) createTime(stat os.FileInfo) time.Time {
stat_t := stat.Sys().(*syscall.Stat_t)
createTime := stat_t.Ctimespec
return time.Unix(createTime.Sec, createTime.Nsec)
// Sec and Nsec are int32 in 32-bit architectures.
return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert
}

0 comments on commit e747045

Please sign in to comment.