Skip to content

Instantly share code, notes, and snippets.

@tdsmith
Last active August 29, 2015 14:06
diff --git a/Mac/Tools/pythonw.c b/Mac/Tools/pythonw.c
index 1d2db38..1edd851 100644
--- a/Mac/Tools/pythonw.c
+++ b/Mac/Tools/pythonw.c
@@ -170,17 +170,8 @@ main(int argc, char **argv) {
*/
char* slash = strrchr(path, '/');
if (slash) {
- char replaced;
- replaced = slash[1];
- slash[1] = 0;
- if (realpath(path, real_path) == NULL) {
- err(1, "realpath: %s", path);
- }
- slash[1] = replaced;
- if (strlcat(real_path, slash, sizeof(real_path)) > sizeof(real_path)) {
- errno = EINVAL;
- err(1, "realpath: %s", path);
- }
+ strncpy(real_path, path, sizeof(real_path));
+ real_path[sizeof(real_path)-1] = 0;
} else {
if (realpath(".", real_path) == NULL) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment