diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/rc/io.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/rc/io.c b/src/cmd/rc/io.c index f2420019..bb8af4ab 100644 --- a/src/cmd/rc/io.c +++ b/src/cmd/rc/io.c @@ -1,3 +1,4 @@ +#include <limits.h> #include "rc.h" #include "exec.h" #include "io.h" @@ -119,14 +120,13 @@ void pdec(io *f, int n) { if(n<0){ - n=-n; - if(n>=0){ + if(n!=INT_MIN){ pchr(f, '-'); - pdec(f, n); + pdec(f, -n); return; } /* n is two's complement minimum integer */ - n = 1-n; + n = -(INT_MIN+1); pchr(f, '-'); pdec(f, n/10); pchr(f, n%10+'1'); |