pmatilai commented on this pull request.
> + int rc = 0, ec = 0;
+
+ if (fd == NULL)
+ return -1;
+
+ fd = fdLink(fd);
+ for (FDSTACK_t fps = fd->fps; fps != NULL; fps = fps->prev) {
+ if (fps->fdno >= 0) {
+ rc = fsync(fps->fdno);
+ if (ec == 0 && rc)
+ ec = rc;
+ }
+
+ /* Leave freeing the last one after stats */
+ if (fps->prev == NULL)
+ break;
This condition is quite clearly a leftover from copy-pasting Fclose(). It's
probably not harmful to the cause here but it's also unnecessary and the
comment is just plain wrong in this context.
The also copy-pasted fdLink() earlier is more harmful, it'll cause a file
descriptor (and memory) leak since it's incrementing the reference count
without ever decrementing it.
These were kinda implied between the lines in the "just walk fps->prev"
(instead of using copy-pasted Fclose code), sorry for not being more clear
about it.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/187#pullrequestreview-30958967
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint