summaryrefslogtreecommitdiff
path: root/sd_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'sd_daemon')
-rw-r--r--sd_daemon/listen_fds.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/sd_daemon/listen_fds.go b/sd_daemon/listen_fds.go
index 51433d9..434f7cc 100644
--- a/sd_daemon/listen_fds.go
+++ b/sd_daemon/listen_fds.go
@@ -1,5 +1,5 @@
// Copyright 2015 CoreOS, Inc.
-// Copyright 2015, 2016 Luke Shumaker
+// Copyright 2015-2016 Luke Shumaker
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -57,13 +57,14 @@ func ListenFds(unsetEnv bool) []*os.File {
names := strings.Split(os.Getenv("LISTEN_FDNAMES"), ":")
files := make([]*os.File, 0, nfds)
- for i = 0; i < nfds; i++ {
+ for i := 0; i < nfds; i++ {
+ fd := i+C.SD_LISTEN_FDS_START
syscall.CloseOnExec(fd)
- name = "unknown"
+ name := "unknown"
if i < len(names) {
name = names[i]
}
- files = append(files, os.NewFile(uintptr(i+C.SD_LISTEN_FDS_START), name))
+ files = append(files, os.NewFile(uintptr(fd), name))
}
return files