Your message dated Fri, 21 Feb 2025 18:27:44 +0100
with message-id 
<trinity-aa1b5972-c765-4e83-9e47-0ac8b2ac1dec-1740158864082@msvc-mesg-gmx123>
and subject line libpaper leaks file descriptor when /etc/papersize is empty
has caused the Debian Bug report #892490,
regarding libpaper leaks file descriptor when /etc/papersize is empty
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
892490: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892490
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libpaper
Version: 1.1.24+nmu5

When the file /etc/papersize or empty, or contains only comments, the
FILE* for reading /etc/papersize is not closed, before falling back to a
default paper size setting.

A simple patch fixes the issue:

diff --git a/lib/paper.c b/lib/paper.c
index d510c85..6ed735e 100644
--- a/lib/paper.c
+++ b/lib/paper.c
@@ -115,9 +115,9 @@ char* systempapername(void) {
     const char* paperconf;
     char* paperstr;
     char* paperenv;
     const char* paperdef;
-    FILE* ps;
+    FILE* ps = NULL;
     struct stat statbuf;
     const struct paper* pp;
     int c;

@@ -198,9 +198,11 @@ PAPERSIZEVAR, fall-back to the old behaviour.
                    return paperstr;
            }
        }
     }
-
+    if (ps)
+        fclose(ps);
+
     paperdef = defaultpapername();
     paperstr = malloc((strlen(paperdef) + 1) * sizeof(char));

     if (paperstr)

--- End Message ---
--- Begin Message ---
Version: 2.2.5-0.1

--- End Message ---

Reply via email to