~ubuntu-branches/ubuntu/utopic/xfsprogs/utopic-proposed

« back to all changes in this revision

Viewing changes to quota/edit.c

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2009-05-06 11:29:18 UTC
  • mfrom: (8.1.1 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090506112918-uzoyzcp90rtr8td7
Tags: 3.0.2
New bugfix release

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
        d.d_rtb_hardlimit = *rtbhard;
141
141
        d.d_rtb_softlimit = *rtbsoft;
142
142
 
143
 
        if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0)
 
143
        if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0) {
 
144
                exitcode = 1;
144
145
                fprintf(stderr, _("%s: cannot set limits: %s\n"),
145
146
                                progname, strerror(errno));
 
147
        }
146
148
}
147
149
 
148
150
static void
159
161
{
160
162
        uid_t           uid = uid_from_string(name);
161
163
 
162
 
        if (uid == -1)
 
164
        if (uid == -1) {
 
165
                exitcode = 1;
163
166
                fprintf(stderr, _("%s: invalid user name: %s\n"),
164
167
                                progname, name);
165
 
        else
 
168
        } else
166
169
                set_limits(uid, type, mask, fs_path->fs_name,
167
170
                                bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
168
171
}
181
184
{
182
185
        gid_t           gid = gid_from_string(name);
183
186
 
184
 
        if (gid == -1)
 
187
        if (gid == -1) {
 
188
                exitcode = 1;
185
189
                fprintf(stderr, _("%s: invalid group name: %s\n"),
186
190
                                progname, name);
187
 
        else
 
191
        } else
188
192
                set_limits(gid, type, mask, fs_path->fs_name,
189
193
                                bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
190
194
}
203
207
{
204
208
        prid_t          prid = prid_from_string(name);
205
209
 
206
 
        if (prid == -1)
 
210
        if (prid == -1) {
 
211
                exitcode = 1;
207
212
                fprintf(stderr, _("%s: invalid project name: %s\n"),
208
213
                                progname, name);
209
 
        else
 
214
        } else
210
215
                set_limits(prid, type, mask, fs_path->fs_name,
211
216
                                bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
212
217
}
228
233
                s = string + length + 1;
229
234
                v = (__uint64_t)cvtnum(blocksize, sectorsize, s);
230
235
                *value = v >> 9;        /* syscalls use basic blocks */
 
236
                if (v > 0 && *value == 0)
 
237
                        fprintf(stderr, _("%s: Warning: `%s' in quota blocks is 0 (unlimited).\n"), progname, s);
231
238
                return 1;
232
239
        }
233
240
        return 0;
315
322
                else if (extractb(s, "rtbhard=", 7, bsize, ssize, &rtbhard))
316
323
                        mask |= FS_DQ_RTBHARD;
317
324
                else {
 
325
                        exitcode = 1;
318
326
                        fprintf(stderr, _("%s: unrecognised argument %s\n"),
319
327
                                progname, s);
320
328
                        return 0;
321
329
                }
322
330
        }
323
331
        if (!mask) {
 
332
                exitcode = 1;
324
333
                fprintf(stderr, _("%s: cannot find any valid arguments\n"),
325
334
                        progname);
326
335
                return 0;
428
437
 
429
438
        if (fname) {
430
439
                if ((fp = fopen(fname, "r")) == NULL) {
 
440
                        exitcode = 1;
431
441
                        fprintf(stderr, _("%s: fopen on %s failed: %s\n"),
432
442
                                progname, fname, strerror(errno));
433
443
                        return 0;
458
468
        d.d_btimer = value;
459
469
        d.d_rtbtimer = value;
460
470
 
461
 
        if (xfsquotactl(XFS_SETQLIM, dev, type, 0, (void *)&d) < 0)
 
471
        if (xfsquotactl(XFS_SETQLIM, dev, type, 0, (void *)&d) < 0) {
 
472
                exitcode = 1;
462
473
                fprintf(stderr, _("%s: cannot set timer: %s\n"),
463
474
                                progname, strerror(errno));
 
475
        }
464
476
}
465
477
 
466
478
static int
530
542
        d.d_bwarns = value;
531
543
        d.d_rtbwarns = value;
532
544
 
533
 
        if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0)
 
545
        if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0) {
 
546
                exitcode = 1;
534
547
                fprintf(stderr, _("%s: cannot set warnings: %s\n"),
535
548
                                progname, strerror(errno));
 
549
        }
536
550
}
537
551
 
538
552
static void
544
558
{
545
559
        uid_t           uid = uid_from_string(name);
546
560
 
547
 
        if (uid == -1)
 
561
        if (uid == -1) {
 
562
                exitcode = 1;
548
563
                fprintf(stderr, _("%s: invalid user name: %s\n"),
549
564
                                progname, name);
550
 
        else
 
565
        } else
551
566
                set_warnings(uid, type, mask, fs_path->fs_name, value);
552
567
}
553
568
 
560
575
{
561
576
        gid_t           gid = gid_from_string(name);
562
577
 
563
 
        if (gid == -1)
 
578
        if (gid == -1) {
 
579
                exitcode = 1;
564
580
                fprintf(stderr, _("%s: invalid group name: %s\n"),
565
581
                                progname, name);
566
 
        else
 
582
        } else
567
583
                set_warnings(gid, type, mask, fs_path->fs_name, value);
568
584
}
569
585
 
576
592
{
577
593
        prid_t          prid = prid_from_string(name);
578
594
 
579
 
        if (prid == -1)
 
595
        if (prid == -1) {
 
596
                exitcode = 1;
580
597
                fprintf(stderr, _("%s: invalid project name: %s\n"),
581
598
                                progname, name);
582
 
        else
 
599
        } else
583
600
                set_warnings(prid, type, mask, fs_path->fs_name, value);
584
601
}
585
602