forked from Imagelibrary/rtems
Patch from Eric Norum <eric@cls.usask.ca>:
I get the following warning when compiling the latest snapshot. I had a quick look at the source -- it certainly looks to me like this is a real bug. ../../../../src/rtems-19990709/c/src/lib/libc/mount.c:97: warning: `options' might be used uninitialized in this function Also, I changed the TFTP test program and TFTP driver to reflect the changes in the way paths are passed to the TFTP driver. The TFTP driver now needs a proper `dotted-decimal' hostname as the second component of the path name.
This commit is contained in:
@@ -430,35 +430,30 @@ int rtems_tftp_open(
|
|||||||
char *remoteFilename;
|
char *remoteFilename;
|
||||||
rtems_interval now;
|
rtems_interval now;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
char *hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This came from the evaluate path.
|
* This came from the evaluate path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cp2 = iop->file_info;
|
cp2 = iop->file_info;
|
||||||
if (*cp2 == '/') {
|
|
||||||
farAddress = rtems_bsdnet_bootp_server_address.s_addr;
|
cp1 = cp2;
|
||||||
|
while (*cp2 != '/') {
|
||||||
|
if (*cp2 == '\0')
|
||||||
|
return ENOENT;
|
||||||
|
cp2++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
char *hostname;
|
|
||||||
|
|
||||||
cp1 = cp2;
|
len = cp2 - cp1;
|
||||||
while (*cp2 != '/') {
|
hostname = malloc (len + 1);
|
||||||
if (*cp2 == '\0')
|
if (hostname == NULL)
|
||||||
return ENOENT;
|
return ENOMEM;
|
||||||
cp2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cp2 - cp1;
|
strncpy (hostname, cp1, len);
|
||||||
hostname = malloc (len + 1);
|
hostname[len] = '\0';
|
||||||
if (hostname == NULL)
|
farAddress = inet_addr (hostname);
|
||||||
return ENOMEM;
|
free (hostname);
|
||||||
|
|
||||||
strncpy (hostname, cp1, len);
|
|
||||||
hostname[len] = '\0';
|
|
||||||
farAddress = inet_addr (hostname);
|
|
||||||
free (hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((farAddress == 0) || (farAddress == ~0))
|
if ((farAddress == 0) || (farAddress == ~0))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|||||||
@@ -430,35 +430,30 @@ int rtems_tftp_open(
|
|||||||
char *remoteFilename;
|
char *remoteFilename;
|
||||||
rtems_interval now;
|
rtems_interval now;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
char *hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This came from the evaluate path.
|
* This came from the evaluate path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cp2 = iop->file_info;
|
cp2 = iop->file_info;
|
||||||
if (*cp2 == '/') {
|
|
||||||
farAddress = rtems_bsdnet_bootp_server_address.s_addr;
|
cp1 = cp2;
|
||||||
|
while (*cp2 != '/') {
|
||||||
|
if (*cp2 == '\0')
|
||||||
|
return ENOENT;
|
||||||
|
cp2++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
char *hostname;
|
|
||||||
|
|
||||||
cp1 = cp2;
|
len = cp2 - cp1;
|
||||||
while (*cp2 != '/') {
|
hostname = malloc (len + 1);
|
||||||
if (*cp2 == '\0')
|
if (hostname == NULL)
|
||||||
return ENOENT;
|
return ENOMEM;
|
||||||
cp2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cp2 - cp1;
|
strncpy (hostname, cp1, len);
|
||||||
hostname = malloc (len + 1);
|
hostname[len] = '\0';
|
||||||
if (hostname == NULL)
|
farAddress = inet_addr (hostname);
|
||||||
return ENOMEM;
|
free (hostname);
|
||||||
|
|
||||||
strncpy (hostname, cp1, len);
|
|
||||||
hostname[len] = '\0';
|
|
||||||
farAddress = inet_addr (hostname);
|
|
||||||
free (hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((farAddress == 0) || (farAddress == ~0))
|
if ((farAddress == 0) || (farAddress == ~0))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|||||||
@@ -430,35 +430,30 @@ int rtems_tftp_open(
|
|||||||
char *remoteFilename;
|
char *remoteFilename;
|
||||||
rtems_interval now;
|
rtems_interval now;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
char *hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This came from the evaluate path.
|
* This came from the evaluate path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cp2 = iop->file_info;
|
cp2 = iop->file_info;
|
||||||
if (*cp2 == '/') {
|
|
||||||
farAddress = rtems_bsdnet_bootp_server_address.s_addr;
|
cp1 = cp2;
|
||||||
|
while (*cp2 != '/') {
|
||||||
|
if (*cp2 == '\0')
|
||||||
|
return ENOENT;
|
||||||
|
cp2++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
char *hostname;
|
|
||||||
|
|
||||||
cp1 = cp2;
|
len = cp2 - cp1;
|
||||||
while (*cp2 != '/') {
|
hostname = malloc (len + 1);
|
||||||
if (*cp2 == '\0')
|
if (hostname == NULL)
|
||||||
return ENOENT;
|
return ENOMEM;
|
||||||
cp2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cp2 - cp1;
|
strncpy (hostname, cp1, len);
|
||||||
hostname = malloc (len + 1);
|
hostname[len] = '\0';
|
||||||
if (hostname == NULL)
|
farAddress = inet_addr (hostname);
|
||||||
return ENOMEM;
|
free (hostname);
|
||||||
|
|
||||||
strncpy (hostname, cp1, len);
|
|
||||||
hostname[len] = '\0';
|
|
||||||
farAddress = inet_addr (hostname);
|
|
||||||
free (hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((farAddress == 0) || (farAddress == ~0))
|
if ((farAddress == 0) || (farAddress == ~0))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|||||||
@@ -430,35 +430,30 @@ int rtems_tftp_open(
|
|||||||
char *remoteFilename;
|
char *remoteFilename;
|
||||||
rtems_interval now;
|
rtems_interval now;
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
|
char *hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This came from the evaluate path.
|
* This came from the evaluate path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cp2 = iop->file_info;
|
cp2 = iop->file_info;
|
||||||
if (*cp2 == '/') {
|
|
||||||
farAddress = rtems_bsdnet_bootp_server_address.s_addr;
|
cp1 = cp2;
|
||||||
|
while (*cp2 != '/') {
|
||||||
|
if (*cp2 == '\0')
|
||||||
|
return ENOENT;
|
||||||
|
cp2++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
char *hostname;
|
|
||||||
|
|
||||||
cp1 = cp2;
|
len = cp2 - cp1;
|
||||||
while (*cp2 != '/') {
|
hostname = malloc (len + 1);
|
||||||
if (*cp2 == '\0')
|
if (hostname == NULL)
|
||||||
return ENOENT;
|
return ENOMEM;
|
||||||
cp2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cp2 - cp1;
|
strncpy (hostname, cp1, len);
|
||||||
hostname = malloc (len + 1);
|
hostname[len] = '\0';
|
||||||
if (hostname == NULL)
|
farAddress = inet_addr (hostname);
|
||||||
return ENOMEM;
|
free (hostname);
|
||||||
|
|
||||||
strncpy (hostname, cp1, len);
|
|
||||||
hostname[len] = '\0';
|
|
||||||
farAddress = inet_addr (hostname);
|
|
||||||
free (hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((farAddress == 0) || (farAddress == ~0))
|
if ((farAddress == 0) || (farAddress == ~0))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|||||||
Reference in New Issue
Block a user