~chrisccoulson/dpkg/ssd-ionice

« back to all changes in this revision

Viewing changes to utils/start-stop-daemon.c

  • Committer: chrisccoulson at googlemail
  • Date: 2009-01-13 21:48:30 UTC
  • Revision ID: chrisccoulson@googlemail.com-20090113214830-xg7m0afinpcw1qpf
Fix FTBFS and use errno to check success of strtol

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
static char *ioprio_data_in = NULL;
154
154
static int ioprio_class = IOPRIO_CLASS_BE;
155
155
static long int ioprio_data = 4;
156
 
static long int ioprio_data_temp = 0;
157
 
static char *temp = NULL;
 
156
static long int ioprio_data_temp = 0;
158
157
 
159
158
#define IOPRIO_CLASS_SHIFT      13
160
159
#define IOPRIO_PRIO_VALUE(class, data)  (((class) << IOPRIO_CLASS_SHIFT) | data)
1392
1391
        if (ioprio_class_in != NULL) {
1393
1392
                if (strcmp(ioprio_class_in, "real-time") == 0) {
1394
1393
                        ioprio_class = IOPRIO_CLASS_RT;
1395
 
                } else if (strcmp(ioprio_class_in, "best-effort") == 0) || (strcmp(ioprio_class_in, "") == 0) {
 
1394
                } else if (strcmp(ioprio_class_in, "best-effort") == 0 || strcmp(ioprio_class_in, "") == 0) {
1396
1395
                        ioprio_class = IOPRIO_CLASS_BE;
1397
1396
                } else if (strcmp(ioprio_class_in, "idle") == 0) {
1398
1397
                        ioprio_class = IOPRIO_CLASS_IDLE;
1405
1404
                                break;
1406
1405
                        default:
1407
1406
                                if (ioprio_data_in != NULL) {
1408
 
                                        ioprio_data_temp = strtol(ioprio_data_in, temp, 10);
1409
 
                                        if (ioprio_data_in != temp) {
 
1407
                                        errno = 0;
 
1408
                                        ioprio_data_temp = strtol(ioprio_data_in, NULL, 10);
 
1409
                                        if (errno == 0) {
1410
1410
                                                ioprio_data = ioprio_data_temp;
1411
1411
                                        } else {
1412
 
                                                fatal("Unrecognized IO scheduler class data %s"; ioprio_data_in);
 
1412
                                                fatal("Unrecognized IO scheduler class data %s", ioprio_data_in);
1413
1413
                                        }
1414
1414
                                }
1415
1415
                }