diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-01 11:47:20 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-01 11:48:48 -0700 |
commit | a40e933b79efe6349151092b3080d2547a9f69b9 (patch) | |
tree | 2ebb6aa6d095b738d5f73a8fd0e7ba7d25034d9d /gpxe/src/net/tcp/iscsi.c | |
parent | a009dceedaedb930dc3458202274d534baeabaf4 (diff) | |
download | syslinux-a40e933b79efe6349151092b3080d2547a9f69b9.tar.gz |
gPXE: merge gPXE 0.9.5
Merge gPXE 0.9.5
gpxe 8c3e95ce420c21e612dbed58fd74dbb01025643f
gpxe-for-syslinux 1982e507d0159d83a542224d4203e964bbd16f7d
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'gpxe/src/net/tcp/iscsi.c')
-rw-r--r-- | gpxe/src/net/tcp/iscsi.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gpxe/src/net/tcp/iscsi.c b/gpxe/src/net/tcp/iscsi.c index 01a46584..e9e36449 100644 --- a/gpxe/src/net/tcp/iscsi.c +++ b/gpxe/src/net/tcp/iscsi.c @@ -1625,25 +1625,28 @@ enum iscsi_root_path_component { */ static int iscsi_parse_lun ( struct iscsi_session *iscsi, const char *lun_string ) { - char *p = ( char * ) lun_string; union { uint64_t u64; uint16_t u16[4]; } lun; + char *p; int i; - /* Empty LUN; assume LUN 0 */ - if ( ! *lun_string ) - return 0; - - for ( i = 0 ; i < 4 ; i++ ) { - lun.u16[i] = strtoul ( p, &p, 16 ); - if ( *p != '-' ) + memset ( &lun, 0, sizeof ( lun ) ); + if ( lun_string ) { + p = ( char * ) lun_string; + + for ( i = 0 ; i < 4 ; i++ ) { + lun.u16[i] = htons ( strtoul ( p, &p, 16 ) ); + if ( *p == '\0' ) + break; + if ( *p != '-' ) + return -EINVAL; + p++; + } + if ( *p ) return -EINVAL; - p++; } - if ( *p ) - return -EINVAL; iscsi->lun = lun.u64; return 0; |