|
@@ -67,10 +67,8 @@ int boot_next_server_and_filename ( struct in_addr next_server,
|
67
|
67
|
|
68
|
68
|
/* Construct URI */
|
69
|
69
|
uri = parse_uri ( filename );
|
70
|
|
- if ( ! uri ) {
|
71
|
|
- printf ( "Out of memory\n" );
|
|
70
|
+ if ( ! uri )
|
72
|
71
|
return -ENOMEM;
|
73
|
|
- }
|
74
|
72
|
filename_is_absolute = uri_is_absolute ( uri );
|
75
|
73
|
uri_put ( uri );
|
76
|
74
|
if ( ! filename_is_absolute ) {
|
|
@@ -86,21 +84,14 @@ int boot_next_server_and_filename ( struct in_addr next_server,
|
86
|
84
|
}
|
87
|
85
|
|
88
|
86
|
image = alloc_image();
|
89
|
|
- if ( ! image ) {
|
90
|
|
- printf ( "Out of memory\n" );
|
|
87
|
+ if ( ! image )
|
91
|
88
|
return -ENOMEM;
|
92
|
|
- }
|
93
|
89
|
if ( ( rc = imgfetch ( image, filename,
|
94
|
90
|
register_and_autoload_image ) ) != 0 ) {
|
95
|
|
- printf ( "Could not load %s: %s\n",
|
96
|
|
- filename, strerror ( rc ) );
|
97
|
91
|
goto done;
|
98
|
92
|
}
|
99
|
|
- if ( ( rc = imgexec ( image ) ) != 0 ) {
|
100
|
|
- printf ( "Could not boot %s: %s\n",
|
101
|
|
- filename, strerror ( rc ) );
|
|
93
|
+ if ( ( rc = imgexec ( image ) ) != 0 )
|
102
|
94
|
goto done;
|
103
|
|
- }
|
104
|
95
|
|
105
|
96
|
done:
|
106
|
97
|
image_put ( image );
|
|
@@ -173,14 +164,25 @@ static int netboot ( struct net_device *netdev ) {
|
173
|
164
|
fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) );
|
174
|
165
|
if ( buf[0] ) {
|
175
|
166
|
printf ( "Booting from filename \"%s\"\n", buf );
|
176
|
|
- return boot_next_server_and_filename ( next_server, buf );
|
|
167
|
+ if ( ( rc = boot_next_server_and_filename ( next_server,
|
|
168
|
+ buf ) ) != 0 ) {
|
|
169
|
+ printf ( "Could not boot from filename \"%s\": %s\n",
|
|
170
|
+ buf, strerror ( rc ) );
|
|
171
|
+ return rc;
|
|
172
|
+ }
|
|
173
|
+ return 0;
|
177
|
174
|
}
|
178
|
175
|
|
179
|
176
|
/* No filename; try the root path */
|
180
|
177
|
fetch_string_setting ( NULL, &root_path_setting, buf, sizeof ( buf ) );
|
181
|
178
|
if ( buf[0] ) {
|
182
|
179
|
printf ( "Booting from root path \"%s\"\n", buf );
|
183
|
|
- return boot_root_path ( buf );
|
|
180
|
+ if ( ( rc = boot_root_path ( buf ) ) != 0 ) {
|
|
181
|
+ printf ( "Could not boot from root path \"%s\": %s\n",
|
|
182
|
+ buf, strerror ( rc ) );
|
|
183
|
+ return rc;
|
|
184
|
+ }
|
|
185
|
+ return 0;
|
184
|
186
|
}
|
185
|
187
|
|
186
|
188
|
printf ( "No filename or root path specified\n" );
|