Author: avos
Date: Wed Jan 30 12:32:47 2019
New Revision: 343576
URL: https://svnweb.freebsd.org/changeset/base/343576

Log:
  ndiscvt(8): abort if no IDs were found during conversion.
  
  Checked with Broadcom driver mentioned in PR 179285.
  
  PR:           69268
  Submitted by: <dar...@dons.net.au>
  MFC after:    5 days

Modified:
  head/usr.sbin/ndiscvt/inf.c
  head/usr.sbin/ndiscvt/ndiscvt.c

Modified: head/usr.sbin/ndiscvt/inf.c
==============================================================================
--- head/usr.sbin/ndiscvt/inf.c Wed Jan 30 11:56:10 2019        (r343575)
+++ head/usr.sbin/ndiscvt/inf.c Wed Jan 30 12:32:47 2019        (r343576)
@@ -62,9 +62,9 @@ static struct assign
                                (struct assign *);
 static struct section
                *find_section   (const char *);
-static void    dump_deviceids_pci      (void);
-static void    dump_deviceids_pcmcia   (void);
-static void    dump_deviceids_usb      (void);
+static int     dump_deviceids_pci      (void);
+static int     dump_deviceids_pcmcia   (void);
+static int     dump_deviceids_usb      (void);
 static void    dump_pci_id     (const char *);
 static void    dump_pcmcia_id  (const char *);
 static void    dump_usb_id     (const char *);
@@ -85,9 +85,11 @@ inf_parse (FILE *fp, FILE *outfp)
        yyin = fp;
        yyparse();
 
-       dump_deviceids_pci();
-       dump_deviceids_pcmcia();
-       dump_deviceids_usb();
+       if (dump_deviceids_pci() == 0 &&
+           dump_deviceids_pcmcia() == 0 &&
+           dump_deviceids_usb() == 0)
+               return (-1);
+
        fprintf(outfp, "#ifdef NDIS_REGVALS\n");
        dump_regvals();
        fprintf(outfp, "#endif /* NDIS_REGVALS */\n");
@@ -280,7 +282,7 @@ dump_usb_id(const char *s)
        fprintf(ofp, "\t\\\n\t{ %s, %s, ", vidstr, pidstr);
 }
 
-static void
+static int
 dump_deviceids_pci()
 {
        struct assign *manf, *dev;
@@ -370,10 +372,10 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
-static void
+static int
 dump_deviceids_pcmcia()
 {
        struct assign *manf, *dev;
@@ -463,10 +465,10 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
-static void
+static int
 dump_deviceids_usb()
 {
        struct assign *manf, *dev;
@@ -556,7 +558,7 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
 static void

Modified: head/usr.sbin/ndiscvt/ndiscvt.c
==============================================================================
--- head/usr.sbin/ndiscvt/ndiscvt.c     Wed Jan 30 11:56:10 2019        
(r343575)
+++ head/usr.sbin/ndiscvt/ndiscvt.c     Wed Jan 30 12:32:47 2019        
(r343576)
@@ -372,7 +372,8 @@ main(int argc, char *argv[])
                        err(1, "opening .INF file '%s' failed", inffile);
 
 
-               inf_parse(fp, outfp);
+               if (inf_parse(fp, outfp) != 0)
+                       errx(1, "creating .INF file - no entries created, are 
you using the correct files?");
                fclose(fp);
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to