Removed buggy burn_strdup() and burn_strndup(). Thanks to Rich Felker.

This commit is contained in:
Thomas Schmitt 2012-08-28 16:20:45 +00:00
parent 4cfa8170ee
commit eb86e5298a
5 changed files with 3 additions and 43 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.07.26.122909" #define Cdrskin_timestamP "2012.08.28.161949"

View File

@ -69,7 +69,7 @@ extern int burn_drive_role_4_allowed;
*/ */
int burn_setup_drive(struct burn_drive *d, char *fname) int burn_setup_drive(struct burn_drive *d, char *fname)
{ {
d->devname = burn_strdup(fname); d->devname = strdup(fname);
memset(&d->params, 0, sizeof(struct params)); memset(&d->params, 0, sizeof(struct params));
d->idata = NULL; d->idata = NULL;
d->mdata = NULL; d->mdata = NULL;

View File

@ -448,7 +448,7 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
out.channel = channel_no; out.channel = channel_no;
out.lun = lun_no; out.lun = lun_no;
out.devname = burn_strdup(fname); out.devname = strdup(fname);
out.cam = NULL; out.cam = NULL;
out.lock_fd = -1; out.lock_fd = -1;

View File

@ -23,42 +23,6 @@
#include "util.h" #include "util.h"
#include "libburn.h" #include "libburn.h"
char *burn_strdup(char *s)
{
char *ret;
int l;
/* ts A61008 */
/* a ssert(s); */
if (s == NULL)
return NULL;
l = strlen(s) + 1;
ret = calloc(1, l);
memcpy(ret, s, l);
return ret;
}
char *burn_strndup(char *s, int n)
{
char *ret;
int l;
/* ts A61008 */
/* a ssert(s); */
/* a ssert(n > 0); */
if (s == NULL || n <= 0)
return NULL;
l = strlen(s);
ret = calloc(1, l < n ? l : n);
memcpy(ret, s, l < n - 1 ? l : n - 1);
ret[n - 1] = '\0';
return ret;
}
void burn_version(int *major, int *minor, int *micro) void burn_version(int *major, int *minor, int *micro)
{ {

View File

@ -1,10 +1,6 @@
#ifndef __UTIL #ifndef __UTIL
#define __UTIL #define __UTIL
char *burn_strdup(char *s);
char *burn_strndup(char *s, int n);
/* ts A90905 */ /* ts A90905 */
int burn_util_make_printable_word(char **text, int flag); int burn_util_make_printable_word(char **text, int flag);