diff options
author | liljencrantz <liljencrantz@gmail.com> | 2007-10-15 19:51:08 +1000 |
---|---|---|
committer | liljencrantz <liljencrantz@gmail.com> | 2007-10-15 19:51:08 +1000 |
commit | dd02e96712eadbf9c5117ad4dabdbedac03eb314 (patch) | |
tree | 13369612bd96bc342fa299505b2a9692e6e1b4ef /exec.c | |
parent | 4163040e56d26deae1e3e2aade8547af18e92afd (diff) |
Second part of improved execve errors - this patch makes the memory limits nicely formated (e.g. 128kB instead of 136549 bytes).
darcs-hash:20071015095108-75c98-51c2ea6ab6edba5d1885eb5938f039054da775e2.gz
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -503,7 +503,13 @@ static void launch_process( process_t *p ) { size_t sz = 0; char **p; + + string_buffer_t sz1; + string_buffer_t sz2; + sb_init( &sz1 ); + sb_init( &sz2 ); + for(p=argv; *p; p++) { sz += strlen(*p)+1; @@ -514,18 +520,25 @@ static void launch_process( process_t *p ) sz += strlen(*p)+1; } + sb_format_size( &sz1, sz ); + #ifdef ARG_MAX + sb_format_size( &sz2, ARG_MAX ); + debug( 0, - L"The total size of the argument and environment lists (%d bytes) exceeds the system limit of %d bytes.", - sz, - ARG_MAX ); + L"The total size of the argument and environment lists (%ls) exceeds the system limit of %ls.", + (wchar_t *)sz1.buff, + (wchar_t *)sz2.buff); #else debug( 0, - L"The total size of the argument and environment lists (%d bytes) exceeds the system limit.", - sz ); + L"The total size of the argument and environment lists (%ls) exceeds the system limit.", + (wchar_t *)sz1.buff); #endif debug( 0, L"Please try running the command again with fewer arguments."); + sb_destroy( &sz1 ); + sb_destroy( &sz2 ); + exit(1); break; |