diff --git a/core/log_io.c b/core/log_io.c
index b4f4f97ce1f8360a14d595f06aae813c116d7d47..f41080da6391f362742111151a7745aedc44c50e 100644
--- a/core/log_io.c
+++ b/core/log_io.c
@@ -576,7 +576,9 @@ inprogress_log_rename(char *filename)
 	assert(strcmp(suffix, inprogress_suffix) == 0);
 
 	/* Create a new filename without '.inprogress' suffix. */
-	new_filename = strndupa(filename, suffix - filename);
+	new_filename = alloca(suffix - filename + 1);
+	memcpy(new_filename, filename, suffix - filename);
+	new_filename[suffix - filename] = '\0';
 
 	if (rename(filename, new_filename) != 0) {
 		say_syserror("can't rename %s to %s", filename, new_filename);
diff --git a/core/tarantool.c b/core/tarantool.c
index 67c74a29fac8575e16ab409323dea99833b90d02..2ed0c9fd2cd51f6da188ff993163a6bc5f9bc69e 100644
--- a/core/tarantool.c
+++ b/core/tarantool.c
@@ -267,6 +267,13 @@ create_pid(void)
 	f = fopen(cfg.pid_file, "a+");
 	if (f == NULL)
 		panic_syserror("can't open pid file");
+	/*
+	 * fopen() is not guaranteed to set the seek position to
+	 * the beginning of file according to ANSI C (and, e.g.,
+	 * on FreeBSD.
+	 */
+	if (fseeko(f, 0, SEEK_SET) != 0)
+		panic_syserror("can't fseek to the beginning of pid file");
 
 	if (fgets(buf, sizeof(buf), f) != NULL && strlen(buf) > 0) {
 		pid = strtol(buf, NULL, 10);
@@ -274,7 +281,8 @@ create_pid(void)
 			panic("the daemon is already running");
 		else
 			say_info("updating a stale pid file");
-		fseeko(f, 0, SEEK_SET);
+		if (fseeko(f, 0, SEEK_SET) != 0)
+			panic_syserror("can't fseek to the beginning of pid file");
 		if (ftruncate(fileno(f), 0) == -1)
 			panic_syserror("ftruncate(`%s')", cfg.pid_file);
 	}