X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnsm%2Ffile.c;h=a12c75300eebab5bc9dd4309e84e1bb88f68a067;hp=98b47bf8bd9f0b4dae29861b446d7ab3f137d134;hb=1ce0374d445d8a3dbdfb3e9da4c76be9df44666b;hpb=0ac600d4766a2e54c6da61148a3266155d36b06a diff --git a/support/nsm/file.c b/support/nsm/file.c index 98b47bf..a12c753 100644 --- a/support/nsm/file.c +++ b/support/nsm/file.c @@ -395,18 +395,18 @@ nsm_drop_privileges(const int pidfd) return false; } - if (st.st_uid == 0) { - xlog_warn("Running as root. " - "chown %s to choose different user", nsm_base_dirname); - return true; - } - if (chdir(nsm_base_dirname) == -1) { xlog(L_ERROR, "Failed to change working directory to %s: %m", nsm_base_dirname); return false; } + if (st.st_uid == 0) { + xlog_warn("Running as root. " + "chown %s to choose different user", nsm_base_dirname); + return true; + } + /* * If the pidfile happens to reside on NFS, dropping privileges * will probably cause us to lose access, even though we are