svn commit: r274791 - head/usr.sbin/ctld

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Nov 21 12:35:19 UTC 2014


Author: trasz
Date: Fri Nov 21 12:35:18 2014
New Revision: 274791
URL: https://svnweb.freebsd.org/changeset/base/274791

Log:
  Add missing error checking for kernel_port_{add,remove}().  Both can fail
  for reasons yet unknown; don't make it increment cumulated_error as a kind
  of temporary workaround.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Fri Nov 21 11:21:39 2014	(r274790)
+++ head/usr.sbin/ctld/ctld.c	Fri Nov 21 12:35:18 2014	(r274791)
@@ -1678,7 +1678,16 @@ conf_apply(struct conf *oldconf, struct 
 					cumulated_error++;
 				}
 			}
-			kernel_port_remove(oldtarg);
+			error = kernel_port_remove(oldtarg);
+			if (error != 0) {
+				log_warnx("failed to remove target %s",
+				    oldtarg->t_name);
+				/*
+				 * XXX: Uncomment after fixing the root cause.
+				 *
+				 * cumulated_error++;
+				 */
+			}
 			continue;
 		}
 
@@ -1812,8 +1821,18 @@ conf_apply(struct conf *oldconf, struct 
 				cumulated_error++;
 			}
 		}
-		if (oldtarg == NULL)
-			kernel_port_add(newtarg);
+		if (oldtarg == NULL) {
+			error = kernel_port_add(newtarg);
+			if (error != 0) {
+				log_warnx("failed to add target %s",
+				    oldtarg->t_name);
+				/*
+				 * XXX: Uncomment after fixing the root cause.
+				 *
+				 * cumulated_error++;
+				 */
+			}
+		}
 	}
 
 	/*


More information about the svn-src-head mailing list