git: edc9c3ee463e - stable/15 - virtual_oss: Combine -d, -l and -L option getopt code

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 17 Mar 2026 12:03:18 UTC
The branch stable/15 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=edc9c3ee463e04475602a665e89b17e6a32f5e96

commit edc9c3ee463e04475602a665e89b17e6a32f5e96
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-03-10 10:55:21 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-03-17 12:03:14 +0000

    virtual_oss: Combine -d, -l and -L option getopt code
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D55671
    
    (cherry picked from commit a2b601343bf9261c4ada51e4d4c30c5b9320bb2b)
---
 usr.sbin/virtual_oss/virtual_oss/main.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c
index 28095880c201..7e677b6c5dbe 100644
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -2226,24 +2226,6 @@ parse_options(int narg, char **pparg, int is_main)
 			strncpy(profile.wav_name, optarg, sizeof(profile.wav_name));
 			break;
 		case 'd':
-			if (strlen(optarg) > VMAX_STRING - 1)
-				return ("Device name too long");
-			strncpy(profile.oss_name, optarg, sizeof(profile.oss_name));
-
-			if (profile.bits == 0 || voss_dsp_sample_rate == 0 ||
-			    profile.channels == 0 || voss_dsp_samples == 0)
-				return ("Missing -b, -r, -c or -s parameters");
-
-			val = (voss_dsp_samples *
-			    profile.bits * profile.channels) / 8;
-			if (val <= 0 || val >= (1024 * 1024))
-				return ("-s option value is too big");
-
-			ptr = dup_profile(&profile, opt_amp, opt_pol,
-			    opt_mute[0], opt_mute[1], 0, 1);
-			if (ptr != NULL)
-				return (ptr);
-			break;
 		case 'L':
 		case 'l':
 			if (strlen(optarg) > VMAX_STRING - 1)
@@ -2252,7 +2234,7 @@ parse_options(int narg, char **pparg, int is_main)
 
 			if (profile.bits == 0 || voss_dsp_sample_rate == 0 ||
 			    profile.channels == 0 || voss_dsp_samples == 0)
-				return ("Missing -b, -r, -r or -s parameters");
+				return ("Missing -b, -r, -c or -s parameters");
 
 			val = (voss_dsp_samples *
 			    profile.bits * profile.channels) / 8;
@@ -2260,7 +2242,7 @@ parse_options(int narg, char **pparg, int is_main)
 				return ("-s option value is too big");
 
 			ptr = dup_profile(&profile, opt_amp, opt_pol,
-			    opt_mute[0], opt_mute[1], c == 'L', 0);
+			    opt_mute[0], opt_mute[1], c == 'L', c == 'd');
 			if (ptr != NULL)
 				return (ptr);
 			break;