Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/perfused - fix warnings



details:   https://anonhg.NetBSD.org/src/rev/d82fd494ad5c
branches:  trunk
changeset: 764477:d82fd494ad5c
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Apr 25 04:30:59 2011 +0000

description:
- fix warnings
- try to handle ENOBUFS in a nicer way
- use errx() for usage message, not err(), as we do not waht strerror(errno)

diffstat:

 usr.sbin/perfused/msg.c      |  22 ++++++++++++++--------
 usr.sbin/perfused/perfused.c |   4 ++--
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (83 lines):

diff -r 979edf95eb7b -r d82fd494ad5c usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c   Mon Apr 25 00:22:37 2011 +0000
+++ b/usr.sbin/perfused/msg.c   Mon Apr 25 04:30:59 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.9 2010/10/11 05:37:58 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.10 2011/04/25 04:30:59 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -498,7 +498,7 @@
        }
 
 #ifdef PERFUSE_DEBUG
-       if (readen != len)
+       if (readen != (ssize_t)len)
                DERRX(EX_SOFTWARE, "%s: short recv %zd/%zd",
                      __func__, readen, len);
 #endif
@@ -513,7 +513,7 @@
 
 #ifdef PERFUSE_DEBUG
        if (len > FUSE_BUFSIZE)
-               DERRX(EX_SOFTWARE, "%s: foh.len = %d", __func__, len);
+               DERRX(EX_SOFTWARE, "%s: foh.len = %zu", __func__, len);
 #endif
 
        /*
@@ -545,7 +545,7 @@
        }
 
 #ifdef PERFUSE_DEBUG
-       if (readen != len)
+       if (readen != (ssize_t)len)
                DERRX(EX_SOFTWARE, "%s: short recv %zd/%zd",
                      __func__, readen, len);
 #endif
@@ -576,10 +576,16 @@
                /* NOTREACHED */
                break;
        case -1:
-               if (errno == EAGAIN)
+               DWARN("%s: send retunred -1, errno = %d", __func__, errno);
+               switch(errno) {
+               case EAGAIN:
+               case ENOBUFS:
                        return 0;
-               DWARN("%s: send retunred -1", __func__);
-               return errno;
+                       break;
+               default:
+                       return errno;
+                       break;
+               }
                /* NOTREACHED */
                break;
        default:
@@ -587,7 +593,7 @@
        }
 
 #ifdef PERFUSE_DEBUG
-       if (written != len)
+       if (written != (ssize_t)len)
                DERRX(EX_SOFTWARE, "%s: short send %zd/%zd",
                      __func__, written, len);
 #endif
diff -r 979edf95eb7b -r d82fd494ad5c usr.sbin/perfused/perfused.c
--- a/usr.sbin/perfused/perfused.c      Mon Apr 25 00:22:37 2011 +0000
+++ b/usr.sbin/perfused/perfused.c      Mon Apr 25 04:30:59 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.11 2010/10/11 05:37:58 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.12 2011/04/25 04:30:59 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -365,7 +365,7 @@
                        foreground = 1;
                        break;
                default:
-                       DERR(EX_USAGE, "%s [-fs] [-d level] [-i fd]", argv[0]);
+                       DERRX(EX_USAGE, "%s [-fs] [-d classes] [-i fd]", argv[0]);
                        break;
                }
        }



Home | Main Index | Thread Index | Old Index