pciutils/pciutils-ocloexec.patch
Tomáš Chvátal 678e2ad8f3 Accepting request 790797 from home:pluskalm:branches:Base:System
- Update to version 3.6.4:
  * A new back-end for the GNU Hurd was contributed by Joan Lledó.
  * When printing VPD item identifiers, non-ASCII characters are escaped.
- Changes for version 3.6.3
  * `lspci -t' (tree mode) can be combined with `-s' to show a sub-tree.
    We also fixed potential buffer overflows in the tree dumper.
  * Cleaned messy code for dumping of I/O, memory, and ROM regions.
    This helped fixing a bug, which caused some 64-bit regions to be
    reported as virtual. All flags are now printed after the address
    (previously, "[virtual]" and "[enhanced]" were before it for no good
    reason).
  * Added pci_find_cap_nr() to the library, which handles capabilities
    which occur multiple times in a single device.
  * Minor improvements in printing of PCIe capabilities.
  * We now decode the Multicast and Secondary PCI Express extended
    capabilities.
  * The list of capability names available to setpci was updated.
  * Minor bugs were fixed in FreeBSD and Solaris ports.
  * We now prefer HTTPS URLs in all documentation
  * The pci.ids file has a man page.
  * As usually, updated pci.ids to the current snapshot of the database.
- Drop no longer relevant pciutils-3.2.0_update-dist.patch
- Do not ship update-pciids script - they are provided via hwdata
  package and we dont want to override data by other packages

OBS-URL: https://build.opensuse.org/request/show/790797
OBS-URL: https://build.opensuse.org/package/show/Base:System/pciutils?expand=0&rev=70
2020-04-02 08:20:59 +00:00

129 lines
4.8 KiB
Diff

Index: pciutils-3.6.4/lib/dump.c
===================================================================
--- pciutils-3.6.4.orig/lib/dump.c
+++ pciutils-3.6.4/lib/dump.c
@@ -64,7 +64,7 @@ dump_init(struct pci_access *a)
if (!name)
a->error("dump: File name not given.");
- if (!(f = fopen(name, "r")))
+ if (!(f = fopen(name, "re")))
a->error("dump: Cannot open %s: %s", name, strerror(errno));
while (fgets(buf, sizeof(buf)-1, f))
{
Index: pciutils-3.6.4/lib/names-cache.c
===================================================================
--- pciutils-3.6.4.orig/lib/names-cache.c
+++ pciutils-3.6.4/lib/names-cache.c
@@ -63,7 +63,7 @@ pci_id_cache_load(struct pci_access *a,
return 0;
}
- f = fopen(name, "rb");
+ f = fopen(name, "rbe");
if (!f)
{
a->debug("Cache file does not exist\n");
@@ -136,7 +136,7 @@ pci_id_cache_flush(struct pci_access *a)
tmpname = pci_malloc(a, strlen(name) + strlen(hostname) + 64);
sprintf(tmpname, "%s.tmp-%s-%d", name, hostname, this_pid);
- f = fopen(tmpname, "wb");
+ f = fopen(tmpname, "wbe");
if (!f)
{
a->warning("Cannot write to %s: %s", name, strerror(errno));
Index: pciutils-3.6.4/lib/names-parse.c
===================================================================
--- pciutils-3.6.4.orig/lib/names-parse.c
+++ pciutils-3.6.4/lib/names-parse.c
@@ -52,7 +52,7 @@ static pci_file pci_open(struct pci_acce
typedef FILE * pci_file;
#define pci_gets(f, l, s) fgets(l, s, f)
#define pci_eof(f) feof(f)
-#define pci_open(a) fopen(a->id_file_name, "r")
+#define pci_open(a) fopen(a->id_file_name, "re")
#define pci_close(f) fclose(f)
#define PCI_ERROR(f, err) if (!err && ferror(f)) err = "I/O error";
#endif
Index: pciutils-3.6.4/lib/proc.c
===================================================================
--- pciutils-3.6.4.orig/lib/proc.c
+++ pciutils-3.6.4/lib/proc.c
@@ -62,7 +62,7 @@ proc_scan(struct pci_access *a)
if (snprintf(buf, sizeof(buf), "%s/devices", pci_get_param(a, "proc.path")) == sizeof(buf))
a->error("File name too long");
- f = fopen(buf, "r");
+ f = fopen(buf, "re");
if (!f)
a->error("Cannot open %s", buf);
while (fgets(buf, sizeof(buf)-1, f))
@@ -129,7 +129,7 @@ proc_setup(struct pci_dev *d, int rw)
if (e < 0 || e >= (int) sizeof(buf))
a->error("File name too long");
a->fd_rw = a->writeable || rw;
- a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY);
+ a->fd = open(buf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC);
if (a->fd < 0)
{
e = snprintf(buf, sizeof(buf), "%s/%04x:%02x/%02x.%d",
@@ -137,7 +137,7 @@ proc_setup(struct pci_dev *d, int rw)
d->domain, d->bus, d->dev, d->func);
if (e < 0 || e >= (int) sizeof(buf))
a->error("File name too long");
- a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY);
+ a->fd = open(buf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC);
}
if (a->fd < 0)
a->warning("Cannot open %s", buf);
Index: pciutils-3.6.4/lib/sysfs.c
===================================================================
--- pciutils-3.6.4.orig/lib/sysfs.c
+++ pciutils-3.6.4/lib/sysfs.c
@@ -96,7 +96,7 @@ sysfs_get_string(struct pci_dev *d, char
void (*warn)(char *msg, ...) = (mandatory ? a->error : a->warning);
sysfs_obj_name(d, object, namebuf);
- fd = open(namebuf, O_RDONLY);
+ fd = open(namebuf, O_RDONLY|O_CLOEXEC);
if (fd < 0)
{
if (mandatory || errno != ENOENT)
@@ -157,7 +157,7 @@ sysfs_get_resources(struct pci_dev *d)
int i;
sysfs_obj_name(d, "resource", namebuf);
- file = fopen(namebuf, "r");
+ file = fopen(namebuf, "re");
if (!file)
a->error("Cannot open %s: %s", namebuf, strerror(errno));
for (i = 0; i < 7; i++)
@@ -271,7 +271,7 @@ sysfs_fill_slots(struct pci_access *a)
n = snprintf(namebuf, OBJNAMELEN, "%s/%s/%s", dirname, entry->d_name, "address");
if (n < 0 || n >= OBJNAMELEN)
a->error("File name too long");
- file = fopen(namebuf, "r");
+ file = fopen(namebuf, "re");
/*
* Old versions of Linux had a fakephp which didn't have an 'address'
* file. There's no useful information to be gleaned from these
@@ -367,7 +367,7 @@ sysfs_setup(struct pci_dev *d, int inten
if (a->fd_vpd < 0)
{
sysfs_obj_name(d, "vpd", namebuf);
- a->fd_vpd = open(namebuf, O_RDONLY);
+ a->fd_vpd = open(namebuf, O_RDONLY|O_CLOEXEC);
/* No warning on error; vpd may be absent or accessible only to root */
}
return a->fd_vpd;
@@ -377,7 +377,7 @@ sysfs_setup(struct pci_dev *d, int inten
{
sysfs_obj_name(d, "config", namebuf);
a->fd_rw = a->writeable || intent == SETUP_WRITE_CONFIG;
- a->fd = open(namebuf, a->fd_rw ? O_RDWR : O_RDONLY);
+ a->fd = open(namebuf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC);
if (a->fd < 0)
a->warning("Cannot open %s", namebuf);
a->fd_pos = 0;