Author: avos
Date: Mon Feb  4 03:44:07 2019
New Revision: 343730
URL: https://svnweb.freebsd.org/changeset/base/343730

Log:
  MFC r343576:
  ndiscvt(8): abort if no IDs were found during conversion.
  
  PR:           69268
  Submitted by: <dar...@dons.net.au>

Modified:
  stable/10/usr.sbin/ndiscvt/inf.c
  stable/10/usr.sbin/ndiscvt/ndiscvt.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/ndiscvt/inf.c
  stable/11/usr.sbin/ndiscvt/ndiscvt.c
  stable/12/usr.sbin/ndiscvt/inf.c
  stable/12/usr.sbin/ndiscvt/ndiscvt.c
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/usr.sbin/ndiscvt/inf.c
==============================================================================
--- stable/10/usr.sbin/ndiscvt/inf.c    Mon Feb  4 02:18:27 2019        
(r343729)
+++ stable/10/usr.sbin/ndiscvt/inf.c    Mon Feb  4 03:44:07 2019        
(r343730)
@@ -60,9 +60,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 *);
@@ -83,9 +83,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");
@@ -278,7 +280,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;
@@ -368,10 +370,10 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
-static void
+static int
 dump_deviceids_pcmcia()
 {
        struct assign *manf, *dev;
@@ -461,10 +463,10 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
-static void
+static int
 dump_deviceids_usb()
 {
        struct assign *manf, *dev;
@@ -554,7 +556,7 @@ done:
 
        fprintf(ofp, "\n\n");
 
-       return;
+       return (found);
 }
 
 static void

Modified: stable/10/usr.sbin/ndiscvt/ndiscvt.c
==============================================================================
--- stable/10/usr.sbin/ndiscvt/ndiscvt.c        Mon Feb  4 02:18:27 2019        
(r343729)
+++ stable/10/usr.sbin/ndiscvt/ndiscvt.c        Mon Feb  4 03:44:07 2019        
(r343730)
@@ -369,7 +369,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-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to