[hackers] [smdev] Don't treat failure to rename an interface as fatal || sin

From: <git_AT_suckless.org>
Date: Thu, 04 Sep 2014 16:54:20 +0200

commit 49b838e3bf8d701ce13795a586ec463656c6c1cd
Author: sin <sin_AT_2f30.org>
Date: Thu Sep 4 15:53:36 2014 +0100

    Don't treat failure to rename an interface as fatal

diff --git a/smdev.c b/smdev.c
index 1c47e25..735f68d 100644
--- a/smdev.c
+++ b/smdev.c
_AT_@ -428,7 +428,7 @@ ifrename(void)
                                 mac2names[i].name, sizeof(ifr.ifr_newname));
                         r = ioctl(sd, SIOCSIFNAME, &ifr);
                         if (r < 0)
- eprintf("SIOCSIFNAME:");
+ weprintf("SIOCSIFNAME:");
                 }
         }
         freeifaddrs(ifas);
diff --git a/util.h b/util.h
index 8fbd961..d1b0e8c 100644
--- a/util.h
+++ b/util.h
_AT_@ -11,6 +11,7 @@ int readuevent(const char *);
 int devtype(const char *);
 void enprintf(int, const char *, ...);
 void eprintf(const char *, ...);
+void weprintf(const char *, ...);
 long estrtol(const char *, int);
 void recurse(const char *, void (*)(const char *));
 #undef strlcpy
diff --git a/util/eprintf.c b/util/eprintf.c
index 72bbd3c..c716143 100644
--- a/util/eprintf.c
+++ b/util/eprintf.c
_AT_@ -33,14 +33,27 @@ enprintf(int status, const char *fmt, ...)
 void
 venprintf(int status, const char *fmt, va_list ap)
 {
- /*fprintf(stderr, "%s: ", argv0);*/
-
         vfprintf(stderr, fmt, ap);
 
- if(fmt[0] && fmt[strlen(fmt)-1] == ':') {
+ if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
                 fputc(' ', stderr);
                 perror(NULL);
         }
 
         exit(status);
 }
+
+void
+weprintf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
+ fputc(' ', stderr);
+ perror(NULL);
+ }
+}
Received on Thu Sep 04 2014 - 16:54:20 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 04 2014 - 17:00:12 CEST