From 9d5baa527140ad1a33cd181fc9b6db64bbfb636d Mon Sep 17 00:00:00 2001 From: James Nugent Date: Thu, 9 Mar 2017 13:49:14 -0500 Subject: [PATCH] client/allocdir: Add missing functions on Solaris This commit adds Solaris versions of the following functions: - `linkDir` - `unlinkDir` - `createSecretDir` - `removeSecretDir` I believe this requires Go 1.8 in order to compile, as the unlink syscall was previously missing. --- client/allocdir/fs_solaris.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 client/allocdir/fs_solaris.go diff --git a/client/allocdir/fs_solaris.go b/client/allocdir/fs_solaris.go new file mode 100644 index 000000000..fe29791c4 --- /dev/null +++ b/client/allocdir/fs_solaris.go @@ -0,0 +1,26 @@ +package allocdir + +import ( + "os" + "syscall" +) + +// linkDir hardlinks src to dst. The src and dst must be on the same filesystem. +func linkDir(src, dst string) error { + return syscall.Link(src, dst) +} + +// unlinkDir removes a directory link. +func unlinkDir(dir string) error { + return syscall.Unlink(dir) +} + +// createSecretDir creates the secrets dir folder at the given path +func createSecretDir(dir string) error { + return os.MkdirAll(dir, 0777) +} + +// removeSecretDir removes the secrets dir folder +func removeSecretDir(dir string) error { + return os.RemoveAll(dir) +}