]> git.pld-linux.org Git - packages/xfsprogs.git/blob - xfsprogs-quota-exitstatus.patch
- release 3
[packages/xfsprogs.git] / xfsprogs-quota-exitstatus.patch
1 diff -urN xfsprogs-2.9.7/quota.org/edit.c xfsprogs-2.9.7/quota/edit.c
2 --- xfsprogs-2.9.7/quota.org/edit.c     2007-09-11 04:01:20.000000000 +0200
3 +++ xfsprogs-2.9.7/quota/edit.c 2008-04-18 15:46:17.838170367 +0200
4 @@ -140,9 +140,11 @@
5         d.d_rtb_hardlimit = *rtbhard;
6         d.d_rtb_softlimit = *rtbsoft;
7  
8 -       if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0)
9 +       if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0) {
10 +               exitcode = 1;
11                 fprintf(stderr, _("%s: cannot set limits: %s\n"),
12                                 progname, strerror(errno));
13 +       }
14  }
15  
16  static void
17 @@ -159,10 +161,11 @@
18  {
19         uid_t           uid = uid_from_string(name);
20  
21 -       if (uid == -1)
22 +       if (uid == -1) {
23 +               exitcode = 1;
24                 fprintf(stderr, _("%s: invalid user name: %s\n"),
25                                 progname, name);
26 -       else
27 +       } else
28                 set_limits(uid, type, mask, fs_path->fs_name,
29                                 bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
30  }
31 @@ -181,10 +184,11 @@
32  {
33         gid_t           gid = gid_from_string(name);
34  
35 -       if (gid == -1)
36 +       if (gid == -1) {
37 +               exitcode = 1;
38                 fprintf(stderr, _("%s: invalid group name: %s\n"),
39                                 progname, name);
40 -       else
41 +       } else
42                 set_limits(gid, type, mask, fs_path->fs_name,
43                                 bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
44  }
45 @@ -203,10 +207,11 @@
46  {
47         prid_t          prid = prid_from_string(name);
48  
49 -       if (prid == -1)
50 +       if (prid == -1) {
51 +               exitcode = 1;
52                 fprintf(stderr, _("%s: invalid project name: %s\n"),
53                                 progname, name);
54 -       else
55 +       } else
56                 set_limits(prid, type, mask, fs_path->fs_name,
57                                 bsoft, bhard, isoft, ihard, rtbsoft, rtbhard);
58  }
59 @@ -315,12 +320,14 @@
60                 else if (extractb(s, "rtbhard=", 7, bsize, ssize, &rtbhard))
61                         mask |= FS_DQ_RTBHARD;
62                 else {
63 +                       exitcode = 1;
64                         fprintf(stderr, _("%s: unrecognised argument %s\n"),
65                                 progname, s);
66                         return 0;
67                 }
68         }
69         if (!mask) {
70 +               exitcode = 1;
71                 fprintf(stderr, _("%s: cannot find any valid arguments\n"),
72                         progname);
73                 return 0;
74 @@ -428,6 +435,7 @@
75  
76         if (fname) {
77                 if ((fp = fopen(fname, "r")) == NULL) {
78 +                       exitcode = 1;
79                         fprintf(stderr, _("%s: fopen on %s failed: %s\n"),
80                                 progname, fname, strerror(errno));
81                         return 0;
82 @@ -458,9 +466,11 @@
83         d.d_btimer = value;
84         d.d_rtbtimer = value;
85  
86 -       if (xfsquotactl(XFS_SETQLIM, dev, type, 0, (void *)&d) < 0)
87 +       if (xfsquotactl(XFS_SETQLIM, dev, type, 0, (void *)&d) < 0) {
88 +               exitcode = 1;
89                 fprintf(stderr, _("%s: cannot set timer: %s\n"),
90                                 progname, strerror(errno));
91 +       }
92  }
93  
94  static int
95 @@ -530,9 +540,11 @@
96         d.d_bwarns = value;
97         d.d_rtbwarns = value;
98  
99 -       if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0)
100 +       if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0) {
101 +               exitcode = 1;
102                 fprintf(stderr, _("%s: cannot set warnings: %s\n"),
103                                 progname, strerror(errno));
104 +       }
105  }
106  
107  static void
108 @@ -544,10 +556,11 @@
109  {
110         uid_t           uid = uid_from_string(name);
111  
112 -       if (uid == -1)
113 +       if (uid == -1) {
114 +               exitcode = 1;
115                 fprintf(stderr, _("%s: invalid user name: %s\n"),
116                                 progname, name);
117 -       else
118 +       } else
119                 set_warnings(uid, type, mask, fs_path->fs_name, value);
120  }
121  
122 @@ -560,10 +573,11 @@
123  {
124         gid_t           gid = gid_from_string(name);
125  
126 -       if (gid == -1)
127 +       if (gid == -1) {
128 +               exitcode = 1;
129                 fprintf(stderr, _("%s: invalid group name: %s\n"),
130                                 progname, name);
131 -       else
132 +       } else
133                 set_warnings(gid, type, mask, fs_path->fs_name, value);
134  }
135  
136 @@ -576,10 +590,11 @@
137  {
138         prid_t          prid = prid_from_string(name);
139  
140 -       if (prid == -1)
141 +       if (prid == -1) {
142 +               exitcode = 1;
143                 fprintf(stderr, _("%s: invalid project name: %s\n"),
144                                 progname, name);
145 -       else
146 +       } else
147                 set_warnings(prid, type, mask, fs_path->fs_name, value);
148  }
149  
150 diff -urN xfsprogs-2.9.7/quota.org/free.c xfsprogs-2.9.7/quota/free.c
151 --- xfsprogs-2.9.7/quota.org/free.c     2007-09-11 04:01:20.000000000 +0200
152 +++ xfsprogs-2.9.7/quota/free.c 2008-04-18 15:46:57.233387016 +0200
153 @@ -61,6 +61,7 @@
154         int                     fd;
155  
156         if ((fd = open(mount->fs_dir, O_RDONLY)) < 0) {
157 +               exitcode = 1;
158                 fprintf(stderr, "%s: cannot open %s: %s\n",
159                         progname, mount->fs_dir, strerror(errno));
160                 return 0;
161 @@ -128,17 +129,20 @@
162                 return 0;
163  
164         if ((fd = open(path->fs_dir, O_RDONLY)) < 0) {
165 +               exitcode = 1;
166                 fprintf(stderr, "%s: cannot open %s: %s\n",
167                         progname, path->fs_dir, strerror(errno));
168                 return 0;
169         }
170  
171         if ((xfsctl(path->fs_dir, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
172 +               exitcode = 1;
173                 perror("XFS_IOC_FSGETXATTR");
174                 close(fd);
175                 return 0;
176         }
177         if (!(fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT)) {
178 +               exitcode = 1;
179                 fprintf(stderr, _("%s: project quota flag not set on %s\n"),
180                         progname, path->fs_dir);
181                 close(fd);
182 @@ -146,6 +150,7 @@
183         }
184  
185         if (path->fs_prid != fsx.fsx_projid) {
186 +               exitcode = 1;
187                 fprintf(stderr,
188                         _("%s: project ID %u (%s) doesn't match ID %u (%s)\n"),
189                         progname, path->fs_prid, projects_file,
190 diff -urN xfsprogs-2.9.7/quota.org/project.c xfsprogs-2.9.7/quota/project.c
191 --- xfsprogs-2.9.7/quota.org/project.c  2007-09-11 04:01:20.000000000 +0200
192 +++ xfsprogs-2.9.7/quota/project.c      2008-04-18 15:49:06.202885828 +0200
193 @@ -91,6 +91,7 @@
194         int                     fd;
195  
196         if (flag == FTW_NS ){
197 +               exitcode = 1;
198                 fprintf(stderr, _("%s: cannot stat file %s\n"), progname, path);
199                 return 0;
200         }
201 @@ -99,14 +100,16 @@
202                 return 0;
203         }
204  
205 -       if ((fd = open(path, O_RDONLY|O_NOCTTY)) == -1)
206 +       if ((fd = open(path, O_RDONLY|O_NOCTTY)) == -1) {
207 +               exitcode = 1;
208                 fprintf(stderr, _("%s: cannot open %s: %s\n"),
209                         progname, path, strerror(errno));
210 -       else if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0)
211 +       } else if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
212 +               exitcode = 1;
213                 fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
214                         progname, path, strerror(errno));
215 -       else {
216 -               if (fsx.fsx_projid != prid)
217 +       } else {
218 +               if (fsx.fsx_projid != prid)
219                         printf(_("%s - project identifier is not set"
220                                  " (inode=%u, tree=%u)\n"),
221                                 path, fsx.fsx_projid, (unsigned int)prid);
222 @@ -130,6 +133,7 @@
223         int                     fd;
224  
225         if (flag == FTW_NS ){
226 +               exitcode = 1;
227                 fprintf(stderr, _("%s: cannot stat file %s\n"), progname, path);
228                 return 0;
229         }
230 @@ -139,10 +143,12 @@
231         }
232  
233         if ((fd = open(path, O_RDONLY|O_NOCTTY)) == -1) {
234 +               exitcode = 1;
235                 fprintf(stderr, _("%s: cannot open %s: %s\n"),
236                         progname, path, strerror(errno));
237                 return 0;
238         } else if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx) < 0) {
239 +               exitcode = 1;
240                 fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
241                         progname, path, strerror(errno));
242                 close(fd);
243 @@ -151,9 +157,11 @@
244  
245         fsx.fsx_projid = 0;
246         fsx.fsx_xflags &= ~XFS_XFLAG_PROJINHERIT;
247 -       if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0)
248 +       if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0) {
249 +               exitcode = 1;
250                 fprintf(stderr, _("%s: cannot clear project on %s: %s\n"),
251                         progname, path, strerror(errno));
252 +       }
253         close(fd);
254         return 0;
255  }
256 @@ -169,6 +177,7 @@
257         int                     fd;
258  
259         if (flag == FTW_NS ){
260 +               exitcode = 1;
261                 fprintf(stderr, _("%s: cannot stat file %s\n"), progname, path);
262                 return 0;
263         }
264 @@ -178,10 +187,12 @@
265         }
266  
267         if ((fd = open(path, O_RDONLY|O_NOCTTY)) == -1) {
268 +               exitcode = 1;
269                 fprintf(stderr, _("%s: cannot open %s: %s\n"),
270                         progname, path, strerror(errno));
271                 return 0;
272         } else if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx) < 0) {
273 +               exitcode = 1;
274                 fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
275                         progname, path, strerror(errno));
276                 close(fd);
277 @@ -190,9 +201,11 @@
278  
279         fsx.fsx_projid = prid;
280         fsx.fsx_xflags |= XFS_XFLAG_PROJINHERIT;
281 -       if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0)
282 +       if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0) {
283 +               exitcode = 1;
284                 fprintf(stderr, _("%s: cannot set project on %s: %s\n"),
285                         progname, path, strerror(errno));
286 +       }
287         close(fd);
288         return 0;
289  }
290 @@ -272,6 +285,7 @@
291  
292         setprfiles();
293         if (access(projects_file, F_OK) != 0) {
294 +               exitcode = 1;
295                 fprintf(stderr, _("projects file \"%s\" doesn't exist\n"),
296                         projects_file);
297                 return 0;
298 @@ -279,10 +293,11 @@
299  
300          while (argc > optind) {
301                 prid = prid_from_string(argv[optind]);
302 -               if (prid == -1)
303 +               if (prid == -1) {
304 +                       exitcode = 1;
305                         fprintf(stderr, _("%s - no such project in %s\n"),
306                                 argv[optind], projects_file);
307 -               else
308 +               } else
309                         project(argv[optind], type);
310                 optind++;
311         }
312 diff -urN xfsprogs-2.9.7/quota.org/quota.c xfsprogs-2.9.7/quota/quota.c
313 --- xfsprogs-2.9.7/quota.org/quota.c    2007-09-11 04:01:20.000000000 +0200
314 +++ xfsprogs-2.9.7/quota/quota.c        2008-04-18 15:49:28.803966289 +0200
315 @@ -231,6 +231,7 @@
316                         id = u->pw_uid;
317                         name = u->pw_name;
318                 } else {
319 +                       exitcode = 1;
320                         fprintf(stderr, _("%s: cannot find user %s\n"),
321                                 progname, name);
322                         return;
323 @@ -280,6 +281,7 @@
324                                 gid = g->gr_gid;
325                                 name = g->gr_name;
326                         } else {
327 +                               exitcode = 1;
328                                 fprintf(stderr, _("%s: cannot find group %s\n"),
329                                         progname, name);
330                                 return;
331 @@ -336,6 +338,7 @@
332         prid_t          id;
333  
334         if (!name) {
335 +               exitcode = 1;
336                 fprintf(stderr, _("%s: must specify a project name/ID\n"),
337                         progname);
338                 return;
339 @@ -348,6 +351,7 @@
340                 id = p->pr_prid;
341                 name = p->pr_name;
342         } else {
343 +               exitcode = 1;
344                 fprintf(stderr, _("%s: cannot find project %s\n"),
345                         progname, name);
346                 return;
347 diff -urN xfsprogs-2.9.7/quota.org/report.c xfsprogs-2.9.7/quota/report.c
348 --- xfsprogs-2.9.7/quota.org/report.c   2007-09-11 04:01:20.000000000 +0200
349 +++ xfsprogs-2.9.7/quota/report.c       2008-04-18 15:49:40.684534248 +0200
350 @@ -115,6 +115,7 @@
351         uint            id;
352  
353         if ((mount = fs_table_lookup(dir, FS_MOUNT_POINT)) == NULL) {
354 +               exitcode = 1;
355                 fprintf(stderr, "%s: cannot find mount point %s\n",
356                         progname, dir);
357                 return;
358 diff -urN xfsprogs-2.9.7/quota.org/state.c xfsprogs-2.9.7/quota/state.c
359 --- xfsprogs-2.9.7/quota.org/state.c    2007-09-11 04:01:20.000000000 +0200
360 +++ xfsprogs-2.9.7/quota/state.c        2008-04-18 15:50:18.026319397 +0200
361 @@ -253,6 +253,7 @@
362  
363         mount = fs_table_lookup(dir, FS_MOUNT_POINT);
364         if (!mount) {
365 +               exitcode = 1;
366                 fprintf(stderr, "%s: unknown mount point %s\n", progname, dir);
367                 return;
368         }
369 @@ -274,6 +275,7 @@
370  
371         mount = fs_table_lookup(dir, FS_MOUNT_POINT);
372         if (!mount) {
373 +               exitcode = 1;
374                 fprintf(stderr, "%s: unknown mount point %s\n", progname, dir);
375                 return;
376         }
377 @@ -295,6 +297,7 @@
378  
379         mount = fs_table_lookup(dir, FS_MOUNT_POINT);
380         if (!mount) {
381 +               exitcode = 1;
382                 fprintf(stderr, "%s: unknown mount point %s\n", progname, dir);
383                 return;
384         }
385 @@ -327,6 +330,7 @@
386  
387         mount = fs_table_lookup(dir, FS_MOUNT_POINT);
388         if (!mount) {
389 +               exitcode = 1;
390                 fprintf(stderr, "%s: unknown mount point %s\n", progname, dir);
391                 return;
392         }
393 diff -urN xfsprogs-2.9.7/quota.org/util.c xfsprogs-2.9.7/quota/util.c
394 --- xfsprogs-2.9.7/quota.org/util.c     2007-09-11 04:01:20.000000000 +0200
395 +++ xfsprogs-2.9.7/quota/util.c 2008-04-18 15:50:29.823550039 +0200
396 @@ -413,11 +413,13 @@
397                 return stdout;
398  
399         if ((fd = open(fname, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0) {
400 +               exitcode = 1;
401                 fprintf(stderr, _("%s: open on %s failed: %s\n"),
402                         progname, fname, strerror(errno));
403                 return NULL;
404         }
405         if ((fp = fdopen(fd, "w")) == NULL) {
406 +               exitcode = 1;
407                 fprintf(stderr, _("%s: fdopen on %s failed: %s\n"),
408                         progname, fname, strerror(errno));
409                 close(fd);
This page took 0.085025 seconds and 3 git commands to generate.