Skip to content

Commit 9c98cc5

Browse files
committed
do not recommend to run system()
1 parent 65acae6 commit 9c98cc5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

file-api.tex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,11 @@
10411041
However, it is not part of SUSv4 and thus not portable, unfortunately.
10421042
The portable way is to call \texttt{stat} on each directory entry.
10431043
\item \texttt{rmdir} does not work on directories that are not empty. You have
1044-
to remove all entries before you can delete a directory. You can use
1045-
\texttt{system("rm -r xxx")} etc. but be careful to sanitize the environment and
1046-
the directory name to avoid any security implications.
1044+
to remove all entries before you can delete a directory. It might be tempting
1045+
to use something like \texttt{system("rm -r xxx")}, e.g. invoke a shell to
1046+
run the \texttt{rm} command etc., however this should be avoided as it is prone
1047+
to errors (the environment and the directory name might be hard to sanitize)
1048+
and might have security implications.
10471049
\item \hlabel{REMOVE} The specification also defines \texttt{remove} which
10481050
behaves like \texttt{unlink} for files and as \texttt{rmdir} for directories.
10491051
\end{itemize}

0 commit comments

Comments
 (0)