Skip to content

Commit fc35c0c

Browse files
committed
Don't error out when scanning for PPDs (Issue #1416)
1 parent 2e7c118 commit fc35c0c

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Changes in CUPS v2.5b1 (YYYY-MM-DD)
154154
- Fixed unreachable block in IPP backend (Issue #1351)
155155
- Fixed memory leak in _cupsConvertOptions (Issue #1354)
156156
- Fixed missing write check in `cupsFileOpen/Fd` (Issue #1360)
157+
- Fixed error recovery when scanning for PPDs in `cups-driverd` (Issue #1416)
157158
- Removed hash support for SHA2-512-224 and SHA2-512-256.
158159
- Removed `mantohtml` script for generating html pages (use
159160
`https://www.msweet.org/mantohtml/`)

scheduler/cups-driverd.cxx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// created from driver information files, and dynamically generated PPD files
66
// using driver helper programs.
77
//
8-
// Copyright © 2020-2024 by OpenPrinting.
8+
// Copyright © 2020-2025 by OpenPrinting.
99
// Copyright © 2007-2019 by Apple Inc.
1010
// Copyright © 1997-2007 by Easy Software Products.
1111
//
@@ -156,7 +156,7 @@ static void list_ppds(int request_id, int limit, const char *opt) _CUPS_NORETUR
156156
static int load_drivers(cups_array_t *include, cups_array_t *exclude);
157157
static int load_drv(const char *filename, const char *name, cups_file_t *fp, time_t mtime, off_t size);
158158
static void load_ppd(const char *filename, const char *name, const char *scheme, struct stat *fileinfo, ppd_info_t *ppd, cups_file_t *fp, off_t end);
159-
static int load_ppds(const char *d, const char *p, int descend);
159+
static void load_ppds(const char *d, const char *p, int descend);
160160
static void load_ppds_dat(char *filename, size_t filesize, int verbose);
161161
static int load_tar(const char *filename, const char *name, cups_file_t *fp, time_t mtime, off_t size);
162162
static int read_tar(cups_file_t *fp, char *name, size_t namesize, struct stat *info);
@@ -2352,7 +2352,7 @@ load_ppd(const char *filename, // I - Real filename
23522352
// 'load_ppds()' - Load PPD files recursively.
23532353
//
23542354

2355-
static int // O - 1 on success, 0 on failure
2355+
static void
23562356
load_ppds(const char *d, // I - Actual directory
23572357
const char *p, // I - Virtual path in name
23582358
int descend) // I - Descend into directories?
@@ -2380,13 +2380,13 @@ load_ppds(const char *d, // I - Actual directory
23802380
fprintf(stderr, "ERROR: [cups-driverd] Unable to stat \"%s\": %s\n", d,
23812381
strerror(errno));
23822382

2383-
return (0);
2383+
return;
23842384
}
23852385
else if (cupsArrayFind(Inodes, &dinfo))
23862386
{
23872387
fprintf(stderr, "ERROR: [cups-driverd] Skipping \"%s\": loop detected!\n",
23882388
d);
2389-
return (1);
2389+
return;
23902390
}
23912391

23922392
/*
@@ -2408,7 +2408,7 @@ load_ppds(const char *d, // I - Actual directory
24082408

24092409
if (_cupsFileCheck(d, _CUPS_FILE_CHECK_DIRECTORY, !geteuid(),
24102410
_cupsFileCheckFilter, NULL))
2411-
return (0);
2411+
return;
24122412

24132413
if ((dir = cupsDirOpen(d)) == NULL)
24142414
{
@@ -2417,7 +2417,7 @@ load_ppds(const char *d, // I - Actual directory
24172417
"ERROR: [cups-driverd] Unable to open PPD directory \"%s\": %s\n",
24182418
d, strerror(errno));
24192419

2420-
return (0);
2420+
return;
24212421
}
24222422

24232423
fprintf(stderr, "DEBUG: [cups-driverd] Loading \"%s\"...\n", d);
@@ -2450,11 +2450,7 @@ load_ppds(const char *d, // I - Actual directory
24502450

24512451
if (descend)
24522452
{
2453-
if (!load_ppds(filename, name, 1))
2454-
{
2455-
cupsDirClose(dir);
2456-
return (1);
2457-
}
2453+
load_ppds(filename, name, 1);
24582454
}
24592455
else if ((ptr = filename + strlen(filename) - 14) > filename &&
24602456
!strcmp(ptr, ".printerDriver"))
@@ -2565,8 +2561,6 @@ load_ppds(const char *d, // I - Actual directory
25652561
}
25662562

25672563
cupsDirClose(dir);
2568-
2569-
return (1);
25702564
}
25712565

25722566

0 commit comments

Comments
 (0)