"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common.c" between
inotify-tools-3.20.2.2.tar.gz and inotify-tools-3.20.11.0.tar.gz

About: inotify-tools offers commandline utilities relating to inotify (wait for or watch particular events on files).

common.c  (inotify-tools-3.20.2.2):common.c  (inotify-tools-3.20.11.0)
skipping to change at line 65 skipping to change at line 65
return S_ISDIR(my_stat.st_mode) && !S_ISLNK(my_stat.st_mode); return S_ISDIR(my_stat.st_mode) && !S_ISLNK(my_stat.st_mode);
} }
FileList construct_path_list(int argc, char **argv, char const *filename) { FileList construct_path_list(int argc, char **argv, char const *filename) {
FileList list; FileList list;
list.watch_files = 0; list.watch_files = 0;
list.exclude_files = 0; list.exclude_files = 0;
FILE *file = 0; FILE *file = 0;
if (!filename) { if (filename) {
} else if (!strcmp(filename, "-")) { if (!strcmp(filename, "-")) {
file = stdin; file = stdin;
} else { } else {
file = fopen(filename, "r"); file = fopen(filename, "r");
}
} }
int watch_len = LIST_CHUNK; int watch_len = LIST_CHUNK;
int exclude_len = LIST_CHUNK; int exclude_len = LIST_CHUNK;
int watch_count = 0; int watch_count = 0;
int exclude_count = 0; int exclude_count = 0;
list.watch_files = (char const **)malloc(sizeof(char *) * watch_len); list.watch_files = (char const **)malloc(sizeof(char *) * watch_len);
list.exclude_files = (char const **)malloc(sizeof(char *) * exclude_len); list.exclude_files = (char const **)malloc(sizeof(char *) * exclude_len);
char name[MAXLEN]; char name[MAXLEN];
skipping to change at line 139 skipping to change at line 140
void warn_inotify_init_error() { void warn_inotify_init_error() {
int error = inotifytools_error(); int error = inotifytools_error();
fprintf(stderr, "Couldn't initialize inotify: %s\n", strerror(error)); fprintf(stderr, "Couldn't initialize inotify: %s\n", strerror(error));
if (error == EMFILE) { if (error == EMFILE) {
fprintf(stderr, "Try increasing the value of " fprintf(stderr, "Try increasing the value of "
"/proc/sys/fs/inotify/max_user_instances\n"); "/proc/sys/fs/inotify/max_user_instances\n");
} }
} }
bool is_timeout_option_valid(long int *timeout, char *optarg) { bool is_timeout_option_valid(long int *timeout, char *o) {
if ((optarg == NULL) || (*optarg == '\0')) { if ((o == NULL) || (*o == '\0')) {
fprintf(stderr, "The provided value is not a valid timeout value.\n" fprintf(stderr, "The provided value is not a valid timeout value.\n"
"Please specify a long int value.\n"); "Please specify a long int value.\n");
return false; return false;
} }
char *timeout_end = NULL; char *timeout_end = NULL;
errno = 0; errno = 0;
*timeout = strtol(optarg, &timeout_end, 10); *timeout = strtol(o, &timeout_end, 10);
const int err = errno; const int err = errno;
if (err != 0) { if (err != 0) {
if (err == ERANGE) { if (err == ERANGE) {
// Figure out on which side it overflows. // Figure out on which side it overflows.
if (*timeout == LONG_MAX) { if (*timeout == LONG_MAX) {
fprintf(stderr, "The timeout value you provided is " fprintf(stderr, "The timeout value you provided is "
"not in the representable range " "not in the representable range "
"(higher than LONG_MAX).\n"); "(higher than LONG_MAX).\n");
} else { } else {
skipping to change at line 175 skipping to change at line 176
fprintf(stderr, "Something went wrong with the timeout " fprintf(stderr, "Something went wrong with the timeout "
"value you provided.\n"); "value you provided.\n");
fprintf(stderr, "%s\n", strerror(err)); fprintf(stderr, "%s\n", strerror(err));
} }
return false; return false;
} }
if (*timeout_end != '\0') { if (*timeout_end != '\0') {
fprintf(stderr, "'%s' is not a valid timeout value.\n" fprintf(stderr, "'%s' is not a valid timeout value.\n"
"Please specify a long int value.\n", "Please specify a long int value.\n",
optarg); o);
return false; return false;
} }
return true; return true;
} }
 End of changes. 4 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)