diff options
author | bsmith%mozilla.com <devnull@localhost> | 2012-11-29 02:11:04 +0000 |
---|---|---|
committer | bsmith%mozilla.com <devnull@localhost> | 2012-11-29 02:11:04 +0000 |
commit | 77ce8912a33ab4d0c37b5bc5e9698b43e1b87889 (patch) | |
tree | f611998d4837f8e5565e80d525a75083d7d9d79b | |
parent | 25d88596d9ca279050b5b4432d0dcdc8b4889cd1 (diff) | |
download | nss-hg-77ce8912a33ab4d0c37b5bc5e9698b43e1b87889.tar.gz |
Bug 812802: Stop addbuiltin from outputting carriage returns on Windows, r=wtc
-rw-r--r-- | security/nss/cmd/addbuiltin/addbuiltin.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/security/nss/cmd/addbuiltin/addbuiltin.c b/security/nss/cmd/addbuiltin/addbuiltin.c index 57b7cdffa..61c6b28ab 100644 --- a/security/nss/cmd/addbuiltin/addbuiltin.c +++ b/security/nss/cmd/addbuiltin/addbuiltin.c @@ -473,6 +473,19 @@ int main(int argc, char **argv) infile = PR_STDIN; } +#if defined(WIN32) + /* We must put stdout into O_BINARY mode or else the output will include + ** carriage returns. + */ + { + int smrv = _setmode(_fileno(stdout), _O_BINARY); + if (smrv == -1) { + fprintf(stderr, "%s: Cannot change stdout to binary mode.\n", progName); + exit(1); + } + } +#endif + nickname = strdup(addbuiltin.options[opt_Nickname].arg); NSS_NoDB_Init(NULL); |