Skip to content

Commit 4e9fecc

Browse files
committed
Sound (NetBSD): don't assume readlink reports file name only
1 parent 1c4953a commit 4e9fecc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/detection/sound/sound_bsd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ const char* ffDetectSound(FFlist* devices)
1515
#else
1616
int defaultDev;
1717
{
18-
char mixerp[8];
19-
if (readlink("/dev/mixer", mixerp, ARRAY_SIZE(mixerp)) != 6)
18+
char mixerp[12];
19+
ssize_t plen = readlink("/dev/mixer", mixerp, ARRAY_SIZE(mixerp));
20+
if (plen < 6)
2021
return "readlink(/dev/mixer) failed";
21-
defaultDev = mixerp[5] - '0';
22+
defaultDev = mixerp[plen - 1] - '0';
2223
if (defaultDev < 0 || defaultDev > 9)
2324
return "Invalid mixer device";
2425
}

0 commit comments

Comments
 (0)