[PATCH 1/4] examples: Properly include getopt.h

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

 



In the admin/logging.c example, the getopt() function is used but
without proper #include. It relies on unistd.h to subsequently
include getopt.h. This is not necessarily always the case.
Also, opterr is not needed and actually not used anywhere else in
our code.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 examples/admin/logging.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/examples/admin/logging.c b/examples/admin/logging.c
index 648d7a6..de258c2 100644
--- a/examples/admin/logging.c
+++ b/examples/admin/logging.c
@@ -1,11 +1,12 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include<stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
 
 #include "config.h"
-#include<unistd.h>
-#include<libvirt/libvirt-admin.h>
-#include<libvirt/virterror.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <libvirt/libvirt-admin.h>
+#include <libvirt/virterror.h>
 
 static void printHelp(const char *argv0)
 {
@@ -31,7 +32,6 @@ int main(int argc, char **argv)
     const char *set_filters = NULL;
 
     ret = c = -1;
-    opterr = 0;
 
     while ((c = getopt(argc, argv, ":hpo:f:")) > 0) {
         switch (c) {
-- 
2.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux