Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159994703
D6467.id16909.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
970 B
Referenced Files
None
Subscribers
None
D6467.id16909.diff
View Options
Index: head/usr.bin/ar/write.c
===================================================================
--- head/usr.bin/ar/write.c
+++ head/usr.bin/ar/write.c
@@ -124,6 +124,7 @@
struct ar_obj *obj;
struct stat sb;
const char *bname;
+ char *tmpname;
if (name == NULL)
return (NULL);
@@ -137,7 +138,10 @@
return (NULL);
}
- if ((bname = basename(name)) == NULL)
+ tmpname = strdup(name);
+ if (tmpname == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ if ((bname = basename(tmpname)) == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, errno, "basename failed");
if (bsdar->options & AR_TR && strlen(bname) > _TRUNCATE_LEN) {
if ((obj->name = malloc(_TRUNCATE_LEN + 1)) == NULL)
@@ -147,6 +151,7 @@
} else
if ((obj->name = strdup(bname)) == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ free(tmpname);
if (fstat(obj->fd, &sb) < 0) {
bsdar_warnc(bsdar, errno, "can't fstat file: %s", obj->name);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jun 21, 8:44 AM (7 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34144601
Default Alt Text
D6467.id16909.diff (970 B)
Attached To
Mode
D6467: Make code compile when basename() is POSIX compliant.
Attached
Detach File
Event Timeline
Log In to Comment