"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib.c" between
mdadm-4.1.tar.gz and mdadm-4.2.tar.gz

About: mdadm is a tool for creating, managing and monitoring device arrays using the "md" driver in Linux, also known as Software RAID arrays.

lib.c  (mdadm-4.1):lib.c  (mdadm-4.2)
skipping to change at line 28 skipping to change at line 28
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Author: Neil Brown * Author: Neil Brown
* Email: <neilb@suse.de> * Email: <neilb@suse.de>
*/ */
#include "mdadm.h" #include "mdadm.h"
#include "dlink.h" #include "dlink.h"
#include <ctype.h> #include <ctype.h>
#include <limits.h>
bool is_dev_alive(char *path)
{
if (!path)
return false;
if (access(path, R_OK) == 0)
return true;
return false;
}
/* This fill contains various 'library' style function. They /* This fill contains various 'library' style function. They
* have no dependency on anything outside this file. * have no dependency on anything outside this file.
*/ */
int get_mdp_major(void) int get_mdp_major(void)
{ {
static int mdp_major = -1; static int mdp_major = -1;
FILE *fl; FILE *fl;
char *w; char *w;
skipping to change at line 537 skipping to change at line 549
void free_line(char *line) void free_line(char *line)
{ {
char *w; char *w;
for (w = dl_next(line); w != line; w = dl_next(line)) { for (w = dl_next(line); w != line; w = dl_next(line)) {
dl_del(w); dl_del(w);
dl_free(w); dl_free(w);
} }
dl_free(line); dl_free(line);
} }
/**
* parse_num() - Parse int from string.
* @dest: Pointer to destination.
* @num: Pointer to string that is going to be parsed.
*
* If string contains anything after a number, error code is returned.
* The same happens when number is bigger than INT_MAX or smaller than 0.
* Writes to destination only if successfully read the number.
*
* Return: 0 on success, 1 otherwise.
*/
int parse_num(int *dest, char *num)
{
char *c = NULL;
long temp;
if (!num)
return 1;
errno = 0;
temp = strtol(num, &c, 10);
if (temp < 0 || temp > INT_MAX || *c || errno != 0 || num == c)
return 1;
*dest = temp;
return 0;
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added

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