Re: [PATCH] If no devices were found do not SIGSEGV (#567939)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> >index bb6ed22..192beb0 100644
> >--- a/loader/driverdisk.c
> >+++ b/loader/driverdisk.c
> >@@ -361,7 +361,7 @@ int getRemovableDevices(char *** devNames) {
> >
> >      devs = getDevices(DEVICE_DISK | DEVICE_CDROM);
> >
> >-    for (i = 0; devs[i] ; i++) {
> >+    if(devs) for (i = 0; devs[i] ; i++) {
> >          if (devs[i]->priv.removable) {
> >              *devNames = realloc(*devNames, (numDevices + 2) * sizeof(char *));
> >              (*devNames)[numDevices] = strdup(devs[i]->device);
> 
> Sorry but having an if and a for on the same line is just too ugly,
> how about this instead:
> +    for (i = 0; devs && devs[i] ; i++) {

Or even:

    devs = getDevices(DEVICE_DISK | DEVICE_CDROM);
    if (!devs)
        return 0;

I don't think missing the logging is such a big deal.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux