From 24e3f4471571cf79539b55efeb45591aef2c49d0 Mon Sep 17 00:00:00 2001
From: Thomas Schmitt <scdbackup@gmx.net>
Date: Sat, 1 Mar 2025 15:10:00 +0100
Subject: [PATCH] Bug fix: Symbolic links with xattr could cause unusable ISO
 filesystems. Thanks Paul von Behren.

---
 libisofs/rockridge.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libisofs/rockridge.c b/libisofs/rockridge.c
index 8e6bc23..05b6104 100644
--- a/libisofs/rockridge.c
+++ b/libisofs/rockridge.c
@@ -1999,7 +1999,10 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
                 cur = strchr(prev, '/');
             }
 
-            if (cew) {
+            if (!cew) {
+                /* the whole SL fits into the SUA */
+                sua_free -= sl_len;
+            } else {
                 ce_len += sl_len;
             }
         }