summaryrefslogtreecommitdiff
path: root/kilo.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-07-02 12:50:34 +0200
committerantirez <antirez@gmail.com>2020-07-02 12:50:39 +0200
commit806d41273267e48611c6c1171c61afa43b88b0c0 (patch)
treef7c5b2aa802d84819b4594240c72ebab95ef77a0 /kilo.c
parente10bc606f03750a211ae430b6e2079d8e5b1ed85 (diff)
downloadfilo-806d41273267e48611c6c1171c61afa43b88b0c0.tar.gz
filo-806d41273267e48611c6c1171c61afa43b88b0c0.zip
Get rid of non ANSI C strdup().
Diffstat (limited to 'kilo.c')
-rw-r--r--kilo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kilo.c b/kilo.c
index c29f626..663e69d 100644
--- a/kilo.c
+++ b/kilo.c
@@ -790,7 +790,9 @@ int editorOpen(char *filename) {
E.dirty = 0;
free(E.filename);
- E.filename = strdup(filename);
+ size_t fnlen = strlen(filename)+1;
+ E.filename = malloc(fnlen);
+ memcpy(E.filename,filename,fnlen);
fp = fopen(filename,"r");
if (!fp) {