[PATCH liburing 1/3] mktemp is dangerous, better use mkostemp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jackieliu@aarch64:~/liburing$ make -C test
...
/tmp/ccoJ4CQ4.o: In function `main':
/home/jackieliu/liburing/test/500f9fbadef8-test.c:41: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'

Signed-off-by: Jackie Liu <liuyun01@xxxxxxxxxx>
---
 test/500f9fbadef8-test.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/500f9fbadef8-test.c b/test/500f9fbadef8-test.c
index 88602ad..b480944 100644
--- a/test/500f9fbadef8-test.c
+++ b/test/500f9fbadef8-test.c
@@ -38,10 +38,9 @@ int main(int argc, char *argv[])
 	}
 
 	sprintf(buf, "./XXXXXX");
-	mktemp(buf);
-	fd = open(buf, O_WRONLY | O_DIRECT | O_CREAT, 0644);
+	fd = mkostemp(buf, O_WRONLY | O_DIRECT | O_CREAT);
 	if (fd < 0) {
-		perror("mkstemp");
+		perror("mkostemp");
 		return 1;
 	}
 
-- 
2.17.1






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux