Module Name:    src
Committed By:   manu
Date:           Mon Apr 25 04:30:59 UTC 2011

Modified Files:
        src/usr.sbin/perfused: msg.c perfused.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/perfused/msg.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/perfused/perfused.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/perfused/msg.c
diff -u src/usr.sbin/perfused/msg.c:1.9 src/usr.sbin/perfused/msg.c:1.10
--- src/usr.sbin/perfused/msg.c:1.9	Mon Oct 11 05:37:58 2010
+++ src/usr.sbin/perfused/msg.c	Mon Apr 25 04:30:59 2011
@@ -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

Index: src/usr.sbin/perfused/perfused.c
diff -u src/usr.sbin/perfused/perfused.c:1.11 src/usr.sbin/perfused/perfused.c:1.12
--- src/usr.sbin/perfused/perfused.c:1.11	Mon Oct 11 05:37:58 2010
+++ src/usr.sbin/perfused/perfused.c	Mon Apr 25 04:30:59 2011
@@ -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;
 		}
 	}

Reply via email to