@@ -195,20 +195,21 @@ static mount_entry_t *parse_mount_entries(const char **argv, int argc) {
195195 }
196196 // if @offset is present, attempt to parse offset
197197 if ((offset_str = strtok (NULL , "@" ))) {
198- char * endptr ;
199198 // check if value is negative
200- if (strtoll (offset_str , NULL , 10 ) < 0 ) {
201- errx (EXIT_FAILURE , "invalid value in offset: %s" , argv [i ]);
199+ long long _f ;
200+ if ((_f = strtoll (offset_str , NULL , 10 )) < 0 ) {
201+ errx (EXIT_FAILURE , "offset (=%lld) must be >0: %s" , _f , argv [i ]);
202202 }
203203 // parse offset
204+ char * endptr ;
204205 offset = strtoul (offset_str , & endptr , 10 );
205- if (errno != 0 || * endptr != '\0' ) {
206- errx (EXIT_FAILURE , "invalid value in offset: %s" , argv [i ]);
206+ if (* endptr != '\0' ) {
207+ errx (EXIT_FAILURE , "invalid value in offset: %s from %s" , offset_str , argv [i ]);
208+ }
209+ // expect file_and_offset only contains one `@`
210+ if (strtok (NULL , "@" )) {
211+ errx (EXIT_FAILURE , "invalid format: %s" , argv [i ]);
207212 }
208- }
209- // expect file_and_offset only contains one `@`
210- if (strtok (NULL , "@" )) {
211- errx (EXIT_FAILURE , "invalid format %s" , argv [i ]);
212213 }
213214
214215 strcpy (mount_entries [i ].squashfs_file , file );
0 commit comments