[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#52454] [PATCH 1/4] syscalls: Add 'lchown'.
From: |
Brice Waegeneire |
Subject: |
[bug#52454] [PATCH 1/4] syscalls: Add 'lchown'. |
Date: |
Sun, 12 Dec 2021 19:36:11 +0100 |
* guix/build/syscalls.scm (lchown): New procedure.
---
guix/build/syscalls.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 63bd017d1d..1c432507c3 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -118,6 +119,7 @@ (define-module (guix build syscalls)
scandir*
getxattr
setxattr
+ lchown
fcntl-flock
lock-file
@@ -1275,6 +1277,20 @@ (define* (scandir* name #:optional
(lambda ()
(closedir* directory)))))
+(define lchown
+ (let ((proc (syscall->procedure int "lchown" (list '* int int))))
+ (lambda (file owner group)
+ "As 'chown', change the ownership and group of the file referred to by
+FILE to the integer values OWNER and GROUP but doesn't dereference symbolic
+links. Unlike 'chown' this doesn't support port or integer file descriptor
+via 'fchown'."
+ (let-values (((ret err)
+ (proc (string->pointer file) owner group)))
+ (unless (zero? ret)
+ (throw 'system-error "lchown" "~S: ~A"
+ (list file (strerror err))
+ (list err)))))))
+
;;;
;;; Advisory file locking.
--
2.34.0
- [bug#52454] [PATCH 0/4] Ensure correct ownership of directory trees in services.Hello Guix,, Brice Waegeneire, 2021/12/12
- [bug#52454] [PATCH 1/4] syscalls: Add 'lchown'.,
Brice Waegeneire <=
- [bug#52454] [PATCH 0/4] Ensure correct ownership of directory trees in services.Hello Guix,, Ludovic Courtès, 2021/12/18
- [bug#52454] [PATCH v2 0/4] Ensure correct ownership of directory trees in services, Brice Waegeneire, 2021/12/21
- [bug#52712] [PATCH v2 4/4] services: cuirass: Ensure correct ownership of directory trees., Brice Waegeneire, 2021/12/21
- [bug#52713] [PATCH v2 2/4] activation: Add 'lchown-recursive'., Brice Waegeneire, 2021/12/21
- [bug#52714] [PATCH v2 3/4] services: postgresql: Ensure correct ownership of directory trees., Brice Waegeneire, 2021/12/21
- [bug#52715] [PATCH v2 1/4] syscalls: Add 'lchown'., Brice Waegeneire, 2021/12/21
- [bug#52454] [PATCH 2/4] activation: Add 'lchown-recursive'., Brice Waegeneire, 2021/12/12
- [bug#52454] [PATCH 4/4] services: cuirass: Ensure correct ownership of directory trees., Brice Waegeneire, 2021/12/12
- [bug#52454] [PATCH 3/4] services: postgresql: Ensure correct ownership of directory trees., Brice Waegeneire, 2021/12/12