| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running quota_nld by systemd might cause the problem that systemd
couldn't open the PID file generated by quota_nld. In fact, the PID
file hasn't existed yet because it originates from the child process
of quota_nld which is a daemon process. As the main process exit,
systemd try to access the PID file but the daemon hadn't create it
that time.
In this situation, we move the procedure of creating PID file into the
parent process to ensure the PID file must existed when quota_nld exit.
After that, the above problem would never occur again.
[JK: Fixed up SIGTERM handling and format strings]
Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
term_action.sa_mask is an automatic variable and and thus unitialized.
This patch empties the signal mask.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While Filesystem Hierarchy Standard prescribes /var/run path for
storing PID files, some (systemd-based) distributions uses /run.
This patch adds a --with-pid-dir=DIRECTORY option to the ./configure
script. The option enables to change the path. Default one is
/var/run as used to be until now.
(I did not use $localstatedir environment variable because Autoconf
manual allows using "precious" variables only in a makefile.)
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
daemon() function can fail. Then we should also report an failure
instead of continuing on foreground.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GCC 8 with GNU libc 2.27 warns:
gcc -DHAVE_CONFIG_H -I. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/libnl3 -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o quota_nld-quota_nld.o `test -f 'quota_nld.c' || echo './'`quota_nld.c
quota_nld.c: In function ‘write_console_warning’:
quota_nld.c:273:7: warning: ‘strcmp’ argument 2 declared attribute ‘nonstring’ [-Wstringop-overflow=]
if (strcmp(user, uent->ut_user))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmp.h:29,
from quota_nld.c:23:
/usr/include/bits/utmp.h:65:8: note: argument ‘ut_user’ declared here
char ut_user[UT_NAMESIZE]
^~~~~~~
This is because ut_user value misses the terminating null byte if it
fits exactly into ut_user array, as document in utmp(5):
String fields are terminated by a null byte ('\0') if they are
shorter than the size of the field.
Recent GCC and glibc recevied compile-time checks and annotations
(__attribute_nonstring_) that catches these mistakes.
This patch fixes it by using strncmp(3) and by ignoring user names
that does not fit into utmp log format. It's better not to warn than
spamming unrelated user.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quota subsystem in kernel introduced project quota. This patch improves
the userspace side.
This patch prevents quota_nld writing warnings to a console when
receiving project quota warnings from kernel because there is no such
concept, "console associated with a project id".
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
| |
Fix compilation warning about missing stat(3) prototype.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
| |
quota_nld has used VFS_DQUOT netlink family id as an id of a multicast
group to listen to. That is wrong - instead proper multicast group id
should be looked up. To do that we need a support for this functionality
in libnl so convert quota_nld to use libnl-3.0 and properly lookup
multicast group id.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
| |
If quota_nld is run as daemon, daemon's PID will be stored into
/var/run/${PROGNAME}.pid file and it will be deleted on receiving SIGTERM
just before program termination.
PID file is used by init scripts to find and kill forked daemon.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
If no utmp record can be found there is obviously nobody to read error
message about missing TTY in sytem log in real time. Moreover the log
is usually illegible for normal user. So it's pointless to log this
fact there for user's sake. warnquota can be used instead.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are some calls (e.g. getpwnam(3)) that can lead to dlopening
other libraries that could jump to symbol with name clashing to one of
global quota symbols. (e.g. Name server switch plug-in nss_db calls
dirname(3) that's already defined in edquota.c and tht can cause
segmentation fault.)
Although it's not possible to solve all these problems, making as much
as possible global objects and functions static is the best thing we
can do to avoid name space polution.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
| |
* Use /proc/mounts for mountpoint scanning (Jan Kara)
* Removed use of reserved identifiers (Jan Kara)
|
|
|
|
| |
* Fixed long option handling of quota_nld (Jan Kara)
|
|
|
|
| |
quota_nld (Jan Kara)
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Added manpage for quota_nld.
|
|
|