summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbsmith%mozilla.com <devnull@localhost>2012-11-29 02:11:04 +0000
committerbsmith%mozilla.com <devnull@localhost>2012-11-29 02:11:04 +0000
commit77ce8912a33ab4d0c37b5bc5e9698b43e1b87889 (patch)
treef611998d4837f8e5565e80d525a75083d7d9d79b
parent25d88596d9ca279050b5b4432d0dcdc8b4889cd1 (diff)
downloadnss-hg-77ce8912a33ab4d0c37b5bc5e9698b43e1b87889.tar.gz
Bug 812802: Stop addbuiltin from outputting carriage returns on Windows, r=wtc
-rw-r--r--security/nss/cmd/addbuiltin/addbuiltin.c13
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);