Skip to content

Commit

Permalink
mxqsub: Implement --tmpdir argument without units
Browse files Browse the repository at this point in the history
The usage string of mxqsub says, that any size can be given without
units, in which case Mebibytes is assumed.

This doesn't currently work for --tmpdir, because the function
mx_strtobytes which is used to convert the string, doesn't accept
numbers without units.

Try mx_strtou64() first to process numerical argments without a unit.
Because tmpdir size is stored in Gibibytes and not Mebibytes internally,
the value needs to be divided by 1024.
  • Loading branch information
donald committed May 25, 2024
1 parent c2a33f8 commit 333912e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mxqsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,10 @@ int main(int argc, char *argv[])
break;

case 7:
{
u_int64_t arg_tmpdir_mb;
if (mx_strtou64(optctl.optarg, &arg_tmpdir_mb) == 0) {
arg_tmpdir = (arg_tmpdir_mb+1024-1)/1024;
} else {
unsigned long long int bytes;
if(mx_strtobytes(optctl.optarg, &bytes) < 0) {
mx_log_crit("--tmpdir '%s': %m", optctl.optarg);
Expand Down

0 comments on commit 333912e

Please sign in to comment.