Skip to content
Myr

xdg: don't double close .desktop FD

Before adoption: this commit came in with the history the project adopted, so no landing records it.

In most cases it's "fine", but since .desktop loading is done threaded, there's a risk another thread opens/dups the same FD between the two close() calls. Closes #497

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 43742d4 · Browse files · 2 files+10 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−3 removed

  • other:+10 added−3 removed

2 files+10 added−3 removed

modified:CHANGELOG.md+3 added
76 unmodified lines
77 event before that ([#482][482]).78* Filenames matching up to the first period only ([#487][487]).79* `wl_seat_release()` used while only binding version 4 of the seat80 interface ([#498][498]).81* Double close of an FD, causing occasional failures to start fuzzel82 ([#497][497]).8384[426]: https://codeberg.org/dnkl/fuzzel/issues/42685[482]: https://codeberg.org/dnkl/fuzzel/issues/48286[487]: https://codeberg.org/dnkl/fuzzel/issues/48787[497]: https://codeberg.org/dnkl/fuzzel/issues/497888990### Security91### Contributors
833 unmodified lines
modified:xdg.c+7 added-3 removed
89 unmodified lines
90 const struct locale_variants *lc_messages,91 application_llist_t *applications)92{93 FILE *f = fdopen(fd, "re");94 if (f == NULL)94 if (f == NULL) {95 close(fd);96 return;97 }9899 bool is_desktop_entry = false;100101 tll(char *) action_names = tll_init();
507 unmodified lines
609 parse_desktop_file(610 fd, id, wfile_basename, terminal, include_actions,611 filter_desktop, desktops,612 &lc_messages, applications);613 /* fd closed by parse_desktop_file() */611 } else614 } else {615 free(id);613 close(fd);616 close(fd);617 }618 }619 }620 }621
193 unmodified lines