2011-04-21 Jon TURNEY * src/mkshortcut/mkshortcut.c (mkshortcut): If we are creating shortcut for all users, ensure it is readable by all users. Index: src/mkshortcut/mkshortcut.c =================================================================== RCS file: /cvs/cygwin-apps/cygutils/src/mkshortcut/mkshortcut.c,v retrieving revision 1.13 diff -u -r1.13 mkshortcut.c --- src/mkshortcut/mkshortcut.c 18 Aug 2010 17:22:36 -0000 1.13 +++ src/mkshortcut/mkshortcut.c 21 Apr 2011 14:12:27 -0000 @@ -41,6 +41,7 @@ #include #include */ +#include static const char versionID[] = PACKAGE_VERSION; static const char revID[] = @@ -611,6 +612,35 @@ } persist_file->lpVtbl->Release (persist_file); shell_link->lpVtbl->Release (shell_link); + + /* If we are creating shortcut for all users, ensure it is readable by all users */ + if (opts.allusers_flag) + { + ssize_t size; + size = cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath, NULL, 0); + if (size >= 0) + { + char *posixpath = malloc(size); + if (!cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath, posixpath, size)) + { + struct stat statbuf; + if (stat(posixpath, &statbuf)) + { + fprintf (stderr, + "%s: stat \"%s\" failed\n", + program_name, posixpath); + } + else if (chmod(posixpath, statbuf.st_mode|S_IRUSR|S_IRGRP|S_IROTH)) + { + fprintf (stderr, + "%s: chmod \"%s\" failed\n", + program_name, posixpath); + } + } + free(posixpath); + } + } + return (0); } else