Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148023681
D23651.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
916 B
Referenced Files
None
Subscribers
None
D23651.id.diff
View Options
Index: head/usr.sbin/sesutil/sesutil.c
===================================================================
--- head/usr.sbin/sesutil/sesutil.c
+++ head/usr.sbin/sesutil/sesutil.c
@@ -570,17 +570,17 @@
{
char ident[DISK_IDENT_SIZE];
struct diocgattr_arg arg;
- char *device, *tmp;
+ char *tmp;
off_t mediasize;
+ int comma;
int fd;
- tmp = strdup(devnames);
+ comma = (int)strcspn(devnames, ",");
+ asprintf(&tmp, "/dev/%.*s", comma, devnames);
if (tmp == NULL)
- err(1, "strdup");
-
- device = strsep(&tmp, ",");
- asprintf(&tmp, "/dev/%s", device);
+ err(1, "asprintf");
fd = open(tmp, O_RDONLY);
+ free(tmp);
if (fd < 0) {
/*
* This can happen with a disk so broken it cannot
@@ -589,6 +589,7 @@
*model = strdup("?");
*serial = strdup("?");
*size = -1;
+ close(fd);
return;
}
@@ -608,6 +609,7 @@
*size = mediasize;
else
*size = -1;
+ close(fd);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 16, 6:06 AM (1 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29757068
Default Alt Text
D23651.id.diff (916 B)
Attached To
Mode
D23651: sesutil: fix Coverity CIDs
Attached
Detach File
Event Timeline
Log In to Comment