guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#63766] [PATCH 0/4] Image for HiFive Unmatched


From: Ludovic Courtès
Subject: [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
Date: Thu, 22 Jun 2023 00:08:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

Efraim Flashner <efraim@flashner.co.il> skribis:

> I changed it to:
>
> (let ((size (partition-size partition)))
>   ;; Create the file and then truncate it to the desired size.
>   (with-output-to-file target
>     (lambda _ (display "")))
>   (truncate-file target size)))
>
> And that got me the empty partition/block device as needed.

A slight improvement would be:

  (catch 'system-error
    (lambda ()
      (truncate-file target size))
    (lambda args
      (if (= ENOENT (system-error-errno args))
          (call-with-output-file target (const #t))
          (apply throw args))))

It’s more verbose but makes the intent clearer.

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]