Fix piping to TortoiseGitUDiff by checking for ERROR_BROKEN_PIPE and treating that...
[TortoiseGit.git] / src / TortoisePlink / Windows / utils / get_system_dir.c
blob3d0fedb64a61b5a4d24c191cde6d02b8a45ff883
1 /*
2 * Wrapper function around GetSystemDirectory that deals with
3 * allocating the output buffer, and also caches the result for future
4 * calls.
5 */
7 #include "putty.h"
9 const char *get_system_dir(void)
11 static char *sysdir = NULL;
12 static size_t sysdirsize = 0;
14 if (!sysdir) {
15 size_t len;
16 while ((len = GetSystemDirectory(sysdir, sysdirsize)) >= sysdirsize)
17 sgrowarray(sysdir, sysdirsize, len);
20 return sysdir;