'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
[oweals/busybox.git] / libbb / wfopen.c
index 9d663281e435b200f399f6702c370dc97a94cf30..9248874a78ba75e0a9a4db2e0b76621f65337ae9 100644 (file)
@@ -7,15 +7,13 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <stdio.h>
-#include <errno.h>
 #include "libbb.h"
 
-FILE *bb_wfopen(const char *path, const char *mode)
+FILE *fopen_or_warn(const char *path, const char *mode)
 {
-       FILE *fp;
-       if ((fp = fopen(path, mode)) == NULL) {
-               bb_perror_msg("%s", path);
+       FILE *fp = fopen(path, mode);
+       if (!fp) {
+               bb_simple_perror_msg(path);
                errno = 0;
        }
        return fp;