Module Name:    src
Committed By:   martin
Date:           Sat Jun 11 18:17:00 UTC 2022

Modified Files:
        src/sys/dev/dkwedge: dk.c

Log Message:
Since rev 1.101 DIOCAWEDGE could return success without filling in the
wedge device name - which is quite confusing for userland.
Always fill the name if we return success.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/dkwedge/dk.c

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

Modified files:

Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.111 src/sys/dev/dkwedge/dk.c:1.112
--- src/sys/dev/dkwedge/dk.c:1.111	Sat Apr 23 16:22:23 2022
+++ src/sys/dev/dkwedge/dk.c	Sat Jun 11 18:17:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.111 2022/04/23 16:22:23 hannken Exp $	*/
+/*	$NetBSD: dk.c,v 1.112 2022/06/11 18:17:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.111 2022/04/23 16:22:23 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.112 2022/06/11 18:17:00 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -483,10 +483,6 @@ dkwedge_add(struct dkwedge_info *dkw)
 		return (ENOMEM);
 	}
 
-	/* Return the devname to the caller. */
-	strlcpy(dkw->dkw_devname, device_xname(sc->sc_dev),
-		sizeof(dkw->dkw_devname));
-
 	/*
 	 * XXX Really ought to make the disk_attach() and the changing
 	 * of state to RUNNING atomic.
@@ -508,6 +504,10 @@ announce:
 	    sc->sc_size, sc->sc_offset,
 	    sc->sc_ptype[0] == '\0' ? "<unknown>" : sc->sc_ptype);
 
+	/* Return the devname to the caller. */
+	strlcpy(dkw->dkw_devname, device_xname(sc->sc_dev),
+		sizeof(dkw->dkw_devname));
+
 	return (0);
 }
 

Reply via email to