* Fix warn_unused_result compiler warnings with FORTIFY_SOURCE defined.

This commit is contained in:
Justin Maggard
2012-03-28 08:15:15 +00:00
parent 29738ed064
commit 40f3664390
8 changed files with 79 additions and 72 deletions

View File

@ -33,6 +33,33 @@
#ifdef ENABLE_NLS
#include <libintl.h>
#endif
#if HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H
#include <ffmpeg/libavutil/avutil.h>
#elif HAVE_LIBAV_LIBAVUTIL_AVUTIL_H
#include <libav/libavutil/avutil.h>
#elif HAVE_LIBAVUTIL_AVUTIL_H
#include <libavutil/avutil.h>
#elif HAVE_FFMPEG_AVUTIL_H
#include <ffmpeg/avutil.h>
#elif HAVE_LIBAV_AVUTIL_H
#include <libav/avutil.h>
#elif HAVE_AVUTIL_H
#include <avutil.h>
#endif
#if HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H
#include <ffmpeg/libavformat/avformat.h>
#elif HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H
#include <libav/libavformat/avformat.h>
#elif HAVE_LIBAVFORMAT_AVFORMAT_H
#include <libavformat/avformat.h>
#elif HAVE_FFMPEG_AVFORMAT_H
#include <ffmpeg/avformat.h>
#elif HAVE_LIBAV_LIBAVFORMAT_H
#include <libav/avformat.h>
#elif HAVE_AVFORMAT_H
#include <avformat.h>
#endif
#include <sqlite3.h>
#include "upnpglobalvars.h"
@ -726,30 +753,28 @@ ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
enum file_types type;
setlocale(LC_COLLATE, "");
if( chdir(dir) != 0 )
return;
DPRINTF(parent?E_INFO:E_WARN, L_SCANNER, _("Scanning %s\n"), dir);
switch( dir_type )
{
case ALL_MEDIA:
n = scandir(".", &namelist, filter_media, alphasort);
n = scandir(dir, &namelist, filter_media, alphasort);
break;
case AUDIO_ONLY:
n = scandir(".", &namelist, filter_audio, alphasort);
n = scandir(dir, &namelist, filter_audio, alphasort);
break;
case VIDEO_ONLY:
n = scandir(".", &namelist, filter_video, alphasort);
n = scandir(dir, &namelist, filter_video, alphasort);
break;
case IMAGES_ONLY:
n = scandir(".", &namelist, filter_images, alphasort);
n = scandir(dir, &namelist, filter_images, alphasort);
break;
default:
n = -1;
break;
}
if (n < 0) {
fprintf(stderr, "Error scanning %s [scandir]\n", dir);
DPRINTF(E_WARN, L_SCANNER, "Error scanning %s\n", dir);
return;
}
@ -794,11 +819,7 @@ ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
free(namelist[i]);
}
free(namelist);
if( parent )
{
chdir(dirname((char*)dir));
}
else
if( !parent )
{
DPRINTF(E_WARN, L_SCANNER, _("Scanning %s finished (%llu files)!\n"), dir, fileno);
}
@ -818,7 +839,8 @@ start_scanner()
if( flag )
fclose(flag);
#endif
freopen("/dev/null", "a", stderr);
av_register_all();
av_log_set_level(AV_LOG_PANIC);
while( media_path )
{
strncpy(name, media_path->path, sizeof(name));
@ -826,7 +848,6 @@ start_scanner()
ScanDirectory(media_path->path, NULL, media_path->type);
media_path = media_path->next;
}
freopen("/proc/self/fd/2", "a", stderr);
#ifdef READYNAS
if( access("/ramfs/.rescan_done", F_OK) == 0 )
system("/bin/sh /ramfs/.rescan_done");